Adding willMoveToParentViewController before removing a view controller.