Fix nullpointer when close fragment