A plant goes hermie because it is a last ditch effort to spread its seeds. A plant's goal in life its to grow, bear fruit, drop seed, and spread offspring into new plants that repeat the same process over and over. By scaring the plant into thinking that it is about to die, it will do anything to carry on its legacy, so they can go hermie and pollinate themselves and produce seeds.

Like mentioned, there are a variety of environmental mistakes that can lead to this. And like also said, it woudl have been preferred to keep the lights on after turning them on early. Plants measure the amount of darkness they have to detirmine whether they are in flowering or veg cycle. So...just remember that the amount of light a plant gets is less important then the amount of darkness. More then 12 hours of darkness would be better then less then 12 hours. For future reference, if it only happens once, even an hour difference in cycle probably wont make much of a difference so dont loose sleep.

This happens indoors and outdoors in nature.