title: How to close a window from an instance of NSObject
body: <p>I started a cocoa project, and it generated AppleDelegate.h, AppleDelegate.m and main.xib files for me. I created some buttons on the window, then create a new class (inherit from NSObject), in the class I do a little thing for button clicks. When one button is clicked, I want the current window to disappear, then a new window to  up. My issue is that I manage to generate a new window when a button is clicked, but I can't figure out how to close the previous window. Do I need to generate my class from NSWindow, instead of NSObject?</p>