The torches light up the hallways so you can see where the animatronics are. By keeping the lights on, you can freeze the animatronics in place so they don't move.
Doors are for when you need an animatronic to go away. What happens is that every few seconds an animatronic tries to move, if it passes a check, it moves forward. If the animatronic hits a door when it tries to move, it goes all the way back to the start of its movement path.