I'm with Erik & Jo, if you've already paid, then yes the sensei has an obligation. If you haven't then no, there's no real obligation, just general courtesy and manners.
This has happened to me as both teacher and student. As the teacher I have always taken the class, but do plead guilty to sometimes finishing a bit earlier (20 mins - half an hour) if the student was relatively inexperienced as I find I had ran through all I intended to teach quicker with just one student and we were both soggy messes on the mat. (I also state my intentions prior to the start of the class and adjust the cost accordingly)
As the student I was happy to accept a beer waza on one occasion instead as I was feeling a wuss that day anyway and the dojo was bloody freezing.