public synchronized void saveAs(File file, boolean associateWithNewFile, TaskMonitor monitor)
			throws IOException, CancelledException {

		checkIsClosed();

		if (file.exists()) {
			throw new DuplicateFileException("File already exists: " + file);
		}

		try {
			LocalBufferFile outFile = new LocalBufferFile(file, bufferMgr.getBufferSize());
			boolean success = false;
			try {
				saveAs(outFile, associateWithNewFile, monitor);
				success = true;
			}
			finally {
				if (!success) {
					outFile.delete();
				}
				else if (!associateWithNewFile) {
					outFile.dispose();
				}
			}
		}
		finally {
			cacheChangedState();
		}
	}
Save the database to the specified buffer file.
@param file buffer file to be created
@param associateWithNewFile if true the outFile will be associated with this DBHandle as the 
current source file, if false no change will be made to this DBHandle's state and the outFile
will be written and set as read-only.  The caller is responsbile for disposing the outFile if 
this parameter is false.
@param monitor progress monitor
@throws DuplicateFileException if file already exists.
@throws IOException if IO error occurs
@throws CancelledException if monitor cancels operation
Ghidra/Framework/DB/src/main/java/db/DBHandle.java