close window when shell exits