Fix close window mechanism when tabs are closed or moved.