JBoolean
JXDockDirector::Close()
{
	JXApplication* app = JXGetApplication();
	JXDockManager* mgr = JXGetDockManager();
	if (mgr->IsLastDock(this) && !app->IsQuitting() && HasWindows())
		{
		app->Quit();
		return kJFalse;
		}
	else
		{
		// We must close all windows before closing ourselves because
		// otherwise, we will get a Draw event after partially destructing
		// if a document needs to ask the user whether or not to close.

		return JI2B( CloseAllWindows() && JXWindowDirector::Close() );
		}
}