Fixed the animation when closing the panels