Turning the lights on with an active terminal will stop the ghost from chasing the robot and stop the ghosts from possessing the human (the shadows). It's important to keep the lights on enough to reduce possessions, while making sure you have enough terminals left to turn on 5 generators as the human.
The shadows are a death sentence for the human if you make a single mistake. It is harder than I intended but acts as a way to challenge you further if you want to maximize your efficiency, and enforce the need to keep the lights on.
There is another segment of the game left after power is restored and the ghosts disappear forever, plus a boss battle :)