Make sure output directory exists before writing output

In case the output is in a subdirectory of `dest`.
Can you remove the `{}` please? I only use them for multi-line statements.