Normal behavior:
- Open the player inventory or entity GUI.
- Observe that `player.opened` is set to this GUI (with e.g. `/c game.print(game.player.opened)`)
- Change the player controller type (e.g. `/c game.player.set_controller{type = defines.controllers.god}`)
- Observe that the inventory or entity GUI is closed.
- Observe that `on_gui_closed` event is triggered.
- Observe that `player.opened` is now nil.
Unexpected behavior:
- Create a custom LuaGuiElement window and display it for the player.
- Assign the custom LuaGuiElement window to `player.opened`. (This means it will be closed when the player presses "Escape", "E", or opens an entity, just like a vanilla GUI.)
- Observe that `player.opened` is correctly set to this GUI (with e.g. `/c game.print(game.player.opened)`)
- Change the player controller type with `player.set_controller{type = defines.controllers.god}`
- Observe that the custom GUI remains visible.
- Observe that `on_gui_closed` event is not triggered (in fact, no event is triggered).
- Observe that `player.opened` is now nil.
- Press E to open player inventory over top of the custom GUI.