public void exit() {
		// For each buffer, the command
		for (FileBuffer fb : dm.getOpenBuffers()) {
			// checks to see if it's saved
			if (fb.isSaved()) {
				// if it is, it closes the buffer
				try {
					dm.close(fb);
				} catch (BufferNotOpenException e1) {
					e1.printStackTrace();
				}
			}
			// if it is not, it asks the user to save
			else {
				int result = JOptionPane.showConfirmDialog(tm,
						"Do you want to save the changes you made to the "
								+ "document \"" + fb.getName() + "\"?");
				// if they don't want to save, close the buffer
				if (result == JOptionPane.NO_OPTION) {
					dm.close();
				} else if (result == JOptionPane.YES_OPTION) {
					// otherwise save the buffer
					try {
						dm.save(tm.getText());
					} catch (IOException e1) {
						e1.printStackTrace();
					}
					dm.close();
				} else {
					return;
				}
			}

			// And finally terminate the application
			System.exit(0);
		}
	}