Add this method to your NSWindowController :

-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
  return YES;
}