Only close the application when all frames are closed