better shutdown and window watcher