boolean saveAll() {
		Program[] programs = programMgr.getAllOpenPrograms();
		List<Program> saveList = new ArrayList<>();
		List<Program> lockList = new ArrayList<>();
		try {
			for (Program program : programs) {
				if (isOnlyToolConsumer(program)) {
					if (!acquireSaveLock(program, "Close")) {
						return false;
					}
					lockList.add(program);
					saveList.add(program);
				}
				else if (isAnalysisTool(program)) {
					if (!acquireSaveLock(program, "Close")) {
						return false;
					}
					lockList.add(program);
				}
			}

			return saveChangedPrograms(saveList);
		}
		finally {
			for (Program p : lockList) {
				p.unlock();
			}
		}
	}
Checks the given program for changes and performs the save if necessary.  The user
is prompted before the save is performed.
@param program program to be closed
@return true if the program can be closed, or false if the operation was cancelled by
the user
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/ProgramSaveManager.java