Fix end game window conflicting with ingame menu

Fixes #6311
Merge pull request #6335 from obrakmann/fix6311

Fix end game window conflicting with ingame menu