public boolean close() {
		if (environment.isDirty()) {
			File file = environment.getFile();
			String title;
			if (file == null)
				title = "untitled";
			else
				title = file.getName();

			int result = JOptionPane.showConfirmDialog(this, "Save " + title
					+ " before closing?");
			if (result == JOptionPane.CANCEL_OPTION)
				return false;
			if (result == JOptionPane.YES_OPTION)
				save(false);
			//called by using alt-f4 in the window
			if (result==-1)
				return false;
		}
		dispose();
		Universe.unregisterFrame(this);
		return true;
	}