Handle Chrome not fully overwriting files by truncating it first. fix localFileSystem to LocalFileSystem.