public boolean closeLevel()
	{
		boolean leave = false;

		// Ask about saving the changes
		if (mapPanel != null && mapPanel.level != null && mapPanel.level.isModified())
		{
			int choice = JOptionPane.showConfirmDialog(fileChooser, "Store the changes to \"" + mapPanel.level.getLevelName() + "\"?", "", JOptionPane.YES_NO_CANCEL_OPTION);

			if (choice == JOptionPane.YES_OPTION)
			{
				if (mapPanel.level.getFilePath() != null)
				{
					mapPanel.level.write(mapPanel.level.getFilePath());
				}
				else
				{
					// ask for the file name
					fileChooser.addChoosableFileFilter(levelFilter);
					fileChooser.setFileFilter(levelFilter);
					int choice2 = fileChooser.showSaveDialog(fileChooser);
					fileChooser.removeChoosableFileFilter(levelFilter);

					if (choice2 == JFileChooser.APPROVE_OPTION)
					{
						File file = fileChooser.getSelectedFile();
						mapPanel.level.setFilePath(file);
						mapPanel.level.write(mapPanel.level.getFilePath());

						leave = true;
					}
				}
			}
			else if (choice == JOptionPane.NO_OPTION)
			{
				leave = true;
			}
		}
		else
		{
			leave = true;
		}

		return leave;
	}