@Test
	public void testCloseToolWithBackgroundTaskRunningAnswerYes() throws Exception {
		// open a program
		ProgramDB program = new ProgramBuilder("notepad", ProgramBuilder._TOY).getProgram();

		// launch a tool with the program
		PluginTool tool = env.launchDefaultTool(program);

		// start a background task that will run until we tell it to finish.
		ControllableBackgroundCommand cmd = new ControllableBackgroundCommand();
		tool.executeBackgroundCommand(cmd, program);
		waitForCommandToStart(cmd);

		// try to close the tool
		closeTool(tool);

		// check for warning dialog
		OptionDialog dialog = waitForDialogComponent(OptionDialog.class);
		assertNotNull("Did not get option dialog to close tool with running task", dialog);
		pressButtonByText(dialog, "Yes");

		waitFor(() -> tool.getToolFrame() == null, "Tool did not close after task");
		stopBackgroundCommand(tool, cmd);
	}
test for creating a new empty tool with the new front end
Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/CloseToolTest.java