Fixing an error causing the main window to crash when closing with no project loaded.