make sure the right window is closed