Fix stack level too deep when writing to ChunkStream