Synchronously write file, to make thread safely.