Fix: preview window did not close when window were closed.