cocoa: dispatch close events properly