writer.py: Appends suffix if file in directory path or filename is directory.

Closes chfoo/wpull#71.