Changed fs.writeFile in writeURLContentsToFile to fs.writeFileSync