Fix bug when closing preview window popout.