If your app delegate doesn't already have an IBOutlet ivar or property to the first window then add one and then use that reference to close the first window. Then create the new window (ether programaticly or by using the makeKeyAndOrderFront method on an IBOutlet ivar or property to the second window (which shouldn't have it's "visible at launch" behavior set)).
// close front window…
NSArray *orderedWindows = [NSApp orderedWindows];
NSWindow *frontWindow = orderedWindows[0];
[frontWindow close];
// create new window…
NSRect windowRect = NSMakeRect(0., 0., 640., 480.);
NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
NSWindow * newWindow = [[NSWindow alloc] initWithContentRect:windowRect styleMask:styleMask backing:NSBackingStoreRetained defer:YES];