lib: Prevent NRE in hide animation listener

The control can be detached from the window before the animation completes. Being detached causes the control to remove
and null its header view reference. So the animation listener onEnd now checks for a non-null header view.