public function close()
{
if ($this->isClosed) {
// TODO: Should this be an error condition? e.g. BadMethodCallException
return;
}
rewind($this->buffer);
$cached = stream_get_contents($this->buffer);
if (strlen($cached) > 0) {
$this->insertChunk($cached);
}
fclose($this->buffer);
$this->fileCollectionInsert();
$this->isClosed = true;
}