improvements to argument parsing

When running the default output format (database), an output directory needs to be specified. I added logic to provide an appropriate error if the output directory is missing. I also fixed the extant_file() function so it passes the error it throws properly. Finally, we can use also extant_file() to check if the output directory exists, so I applied that function to the directory argument's type.
Typo, sorry. Lines 265-270 should be indented a level less. (As I was committing, I noticed that the code mixes tabs and spaces.  I tried to fix it for this section, but accidentally borked it instead!)