Minor imrpovements to compressing output stream, to avoid separate writes for headers, data