Fixed logic of animation for open/close