Catching exceptions when output file cannot be opened or written and print some warnings when input files cannot be processed