add support for writing compressed output
bug fix in getting fh
format fix for docs
Merge branch 'topic/compress_output'