>> If your two aux filenames are A and B, during the first run you read
>> From A and write to B. Presuming no errors, during your next run
>> however you need to read from B and write to A. How do you keep
No idea how Frank does it, but at successful completion I close A and B,
open B for input and A for output, and copy B to A in a robust environment
(sorry, not the LaTeX sense of "robust" but then I don't speak LaTeX!).
It _can_ go wrong during the copy, but only in the event of a machine failure
or running out of disc space, provided that the environment is sufficiently
robust. Since the final record copied can be (e.g.) "%! TeX copy complete",
one can always search for this on re-opening to ensure that the file is valid.