At the end of level 3, you fight some of those flying Cacodemon clones while in a pool of water. At one side of the room (opposite side of where you entered the room), there is an exit door with a switch to the left and a switch to the right.
If you press the switches, they light up for about 1second, then shut Off.
So... What are they doing and how do I get the exit door to open?