Fixed a bug that occured when closing the main window.