Bug fixed by using try and catch on onStop.