Added terminating app after second trial of exiting (GUI).