Fixed the app closing when updating with the main activity in background