Hide panel if it is still shown when changing the panel