Use sync versions of writeFile in cleanUpLocal, prevents error messages like #352.