Added error checking for the file copy step.