Fix UTF8 encoded outputs in MemPipeline.write