Fix bugs related to failed handling

Duplicate less of the existing code, preventing processing failed
downloads from failing if the folder isn't deleted before processing.