import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
  func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
    return true
  }
}


import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
}


--- 
+++ 
@@ -2,5 +2,8 @@
 
 @NSApplicationMain
 class AppDelegate: NSObject, NSApplicationDelegate {
+  func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
+    return true
+  }
 }
 
Terminate when the window is closed
