Changed the deletion of windows