Fixed a critical error where the windows wouldn't close