keep NSWindow calls on the same thread

fixes #1731