Fix corrupt files when writing to stdout, and redirecting
Fix corrupt files when writing to stdout, and redirecting

Listen on the `drain` event to determine when the "stream" is
ready, and if so, we can gracefully terminate the CLI app.

arachnys/athenapdf,hivelocity/athenapdf,arachnys/athenapdf,hivelocity/athenapdf,arachnys/athenapdf,hivelocity/athenapdf