public function writeEndElement(): self
    {
        if ($this->isFinished()) {
            throw new \LogicException('Can not write end elements, no element open.');
        }

        $this->doWriteEndElement();
        $this->depth--;
        return $this;
    }