public function close()
{
if ($this->closed) {
return;
}
$data = $this->encoder->finish();
$this->emit('data', [$data]);
$this->closed = true;
$this->emit('close');
$this->removeAllListeners();
}