Improved performance of window closing.