Implemented proper android application life cycle

haven't looked through it all but added in the way to get the app to properly close