Added proper exit functionality for Android.