One-Way Entrance

"And consider this dismaying observation: this chamber has no windows, and no doors. Which offers you this chilling challenge: to find a way out"

- Haunted Mansion ride

If the protagonists go into a haunted building, there is a non-zero chance that while their back is turned the walls and doors will turn into hole-less walls, leaving the unfortunate protagonists trapped inside. A less supernatural variant is for the doors to slam shut behind them and refuse to open.

See also: Locked in a Room and It Was Here, I Swear

Amusement Park Rides

 * This is part of the story of The Haunted Mansion Disney ride.

Video Games

 * The Evil Within 2: When Sebastian enters a new hallway, the blood stained door vanishes!

Western Animation

 * Samurai Jack and the Haunted House.
 * Doug: While at a haunted house ride the floor in one of the rooms, the floor.

Slammed Shut and Locked/Jammed

 * In Gravity Falls episode The Inconveniencing, the doors slam shut after the group tries to leave.
 * In The Magic School Bus episode, aptly named "In the Haunted House", the door to the Sound Museum slammed shut after when all of the class went inside the mansion.

Tabletop Games

 * Considering you can't just leave through the front door of Betrayal at House on the Hill, and the genre, this trope is in play.