fixed an error where the application would still run in the background after the close button was pressed