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

Fixes #436.