private int saveFreeIndexList() throws IOException {
		
		int freeListIndex = vfIndexProvider.allocateIndex();
		int thisIndex = freeListIndex;
		int nextIndex = -1;

		int maxOffset = bufferSize - FREE_LIST_ENTRY_SIZE;
		
		DataBuffer buf = new DataBuffer(bufferSize);
		buf.setId(thisIndex);
		int offset = FIRST_ENTRY_OFFSET;
		
		// Save freeIndexes entries
		for (int i = 0; i < freeIndexes.length; i++) {

			if (offset > maxOffset) {
				nextIndex = vfIndexProvider.allocateIndex();
				buf.putInt(NEXT_BUFFER_INDEX_OFFSET, nextIndex);
				versionFile.put(buf, thisIndex);

				offset = FIRST_ENTRY_OFFSET;
				thisIndex = nextIndex;
				buf.setId(thisIndex);
			}
			
			// Save list entry as single integer
			offset = buf.putInt(offset, freeIndexes[i]);
		}
		
		// Mark end of list
		if (offset > maxOffset) {	
			nextIndex = vfIndexProvider.allocateIndex();
			buf.putInt(NEXT_BUFFER_INDEX_OFFSET, nextIndex);
			versionFile.put(buf, thisIndex);

			offset = FIRST_ENTRY_OFFSET;
			thisIndex = nextIndex;
			buf.setId(thisIndex);
		}
		buf.putInt(offset, -1);
		
		// Make sure last buffer is saved
		buf.putInt(NEXT_BUFFER_INDEX_OFFSET, -1);
		versionFile.put(buf, thisIndex);

		return freeListIndex;
	}
Reopen version file as read-only
@throws IOException
Ghidra/Framework/DB/src/main/java/db/buffers/VersionFile.java