Fix NPE if activity is closed before its finished opening.