Applications can't be closed, only quit. Only windows can be closed, not applications.
If you want to quit the application when only a specific window is closed, be that window's delegate and respond to the windowWillClose:
message by telling the application to terminate.