public function finish() { $this->writer->endElement(); $this->writer->endDocument(); $this->fileSystem->putContent($this->filename, $this->writer->outputMemory()); }