public function complete() { $this->flushBuffer(true); $document = $this->insertFile(); $this->isComplete = true; return $document; }