add IO exception handling for file copying