Issue #848

Hold a weak reference to NSWindow, and let system window server manages its lifetime

weak var window = NSWindow()
window.isReleasedWhenClosed = true