How to make a Cocoa application quit when the main window is closed? Without that you have to click on the app icon and click quit in the menu.
Add this code snippet to your app's delegate:
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app { return YES; }