Use `gzip` command to write `*.gz` files

At the time of this commit, Python's core `gzip` module is about 10X
slower than the `gzip` command.

Close #989.