Raising exception when one is encountered.
Adding source file removal

The exception being raised was due to os.remove … some other process
was using the file.
Moving the location of the close() call.