Support to compress the output with libz.
Bug fix---open output file in binary mode

This isn't required for Unix, but key, let's be pedantically correct.