Replace fs.renameSync with fs.rename.