Bug fixing: catching error in the middle of a file copy