@Override
		public void run() {

			DataBuffer buf = new DataBuffer(getBufferSize());
			boolean success = false;
			try {
				// Initial delay
				Thread.sleep(100);

				// Copy non-empty buffers only
				// Remaining content established by BuffermMgr.saveAs()
				int cnt = srcFile.getIndexCount();
				maxIndex = cnt - 1;
				for (curIndex = 0; curIndex < cnt; curIndex++) {
					while (true) {
						synchronized (preSaveLock) {
							// Check for canceled task
							checkPreSaveMonitor();
							if (taskThread.isInterrupted()) {
								return;
							}
							// Continue to back-off while primary buffer file instance is in use
							if (!preSaveBackoff) {
								break;
							}
							preSaveBackoff = false;
						}
						// Back-off a little
						Thread.sleep(50);
					}
					srcFile.get(buf, curIndex);
					preSaveFile.put(buf, curIndex);
				}
				success = true;
			}
			catch (InterruptedException e) {
				checkPreSaveMonitor();
			}
			catch (Throwable t) {
				Msg.error(this, t);
			}
			finally {
				if (!success) {
					preSaveFile.setTemporary(true);
					try {
						preSaveFile.close();
					}
					catch (IOException e) {
						Msg.error(this, e);
					}
					finally {
						preSaveFile = null;
						preSaveFailed = true;
					}
				}
				try {
					srcFile.close();
				}
				catch (IOException e) {
					Msg.error(this, e);
				}
			}
		}
Perform pre-save of sourceFile to preSaveFile.
The preSaveFile is changed to null if an error occurs.
Ghidra/Framework/DB/src/main/java/db/buffers/LocalManagedBufferFile.java