Add -debug option and better handle inability to open output file.
Allow specifying outfile as second non-option argument.