There was a time delay on the lights switching off, but it wasn't a good idea to linger in the toilet cubicle...
I have experienced this problem a number of times. There is nothing like being caught with your pants around your ankles inside a pitch black windowless room. You are left sitting there wondering if anyone will come in anytime soon and trigger the lights or you get the opportunity to try and clean up in the dark and move around outside the stall so the sensor will turn the damn lights back on.