Use Std lib provided tmpfile to prevent multiple processes wrting to a file at the same time.