Found a couple of cases that the player can get trapped (played with GZDoom 3.5.1 and HMP difficulty):
1. The death knight and two cacodemons spawn before I enter the huge room with the switch to yellow key. The door is supposed to be closed when I entered the room and opened by killing the death knight. But if I kill the death knight while being outside of the room, entering the room will get me trapped.
2. A similar situation happened on fighting the spider mastermind. I can trigger the first trigger line to get it spawned and kill it, then if I enter the area (triggered the second line) the four pillars will raise and get me trapped.