Don't write to stdout if `--output` is specified

Fixes #436.
Merge pull request #440 from kevva/stdout-fix

Don't write to stdout if `--output` is specified