prevent race conditions in rlwriter.toc by using a tmp directory