Add a currentDistance field to the temp file, aka, potential record data file.
Deal with the situation that if temp file doesn’t exist, do not write to record.