How do I get an Objective-C application to terminate when the users presses the window's close button?

I want my application to quit when the user closes its unique window...
You have to implement
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
in your application's delegate and makes it returns YES.