Made to dispose the app when frame closes