private void writeCheckoutsFile() throws IOException {

		// Output checkouts as XML
		Element root = new Element("CHECKOUT_LIST");
		root.setAttribute("NEXT_ID", Long.toString(nextCheckoutId));

		for (ItemCheckoutStatus status : checkouts.values()) {
			// TRANSIENT checkout data must not be persisted - the existence
			// of such checkouts is retained in-memory only
			if (status.getCheckoutType() != CheckoutType.TRANSIENT) {
				root.addContent(getCheckoutElement(status));
			}
		}

		File checkoutsFile = getCheckoutsFile();

		// Store checkout data in temporary file
		File tmpFile = new File(checkoutsFile.getParentFile(), checkoutsFile.getName() + ".new");
		tmpFile.delete();
		FileOutputStream ostream = new FileOutputStream(tmpFile);
		BufferedOutputStream bos = new BufferedOutputStream(ostream);

		try {
			Document doc = new Document(root);
			XMLOutputter xmlout = new GenericXMLOutputter();
			xmlout.output(doc, bos);
		}
		finally {
			bos.close();
		}

		// Rename files
		File oldFile = null;
		if (checkoutsFile.exists()) {
			oldFile = new File(checkoutsFile.getParentFile(), checkoutsFile.getName() + ".bak");
			oldFile.delete();
			if (!checkoutsFile.renameTo(oldFile)) {
				throw new IOException("Failed to update checkouts: " + item.getPathName());
			}
		}
		if (!tmpFile.renameTo(checkoutsFile)) {
			if (oldFile != null) {
				oldFile.renameTo(checkoutsFile);
			}
			throw new IOException("Failed to update checkouts: " + item.getPathName());
		}
		if (oldFile != null) {
			oldFile.delete();
		}
	}
Write checkout data file.

@throws IOException
Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/CheckoutManager.java