Fix for gzip bug with Python3.2.

gzip can only read in text mode for Python3.3 and above, so for now wrap it in a TextIOWrapper.

ItsdbProfile.write_profile now allows gzip=None, which uses whatever the original file was, instead of forcing gzip (yes or no) on all files.

Also resolved a bug with ItsdbProfile.write_profile where files originally gzipped were not being written.