Open bad file in write mode
Refactor processing to separate downloading and processing records