Fix window close button not resetting popup