Create directories using os.makedirs with exist_ok=True.

Aside from being cleaner, this way will only suppress the error if the
*directory* already exists — if there's a file at that path, it'll
still raise an error.

It'll also make directories above output_dir if need be.  I'm not sure
this is likely to matter one way or the other.