Added support for closing the app when we close the window