Replace hand-rolled copyfile with shutil.copyfile