move nswindow close to main thread 0 to fix a potential crash on exit