Fix issue with writing strings in io::compressed_file_writer.

Problem was only apparent when writing utf8 strings that contain non-ASCII
characters.