Improved option handling

Previously the script would generate a 0-length output file if both the --output_file and --output_dir options were passed. It no longer does this, instead printing an explicit warning that --output_file is going to be ignored (as per the command-line documentation.)

Also, if an --output_dir is specified but does not exist then an error will be printed and the script will exit gracefully, rather than failing on the file open() call (the previous behavior.)