public function commit()
    {
        if ($this->readOnly) {
            return false;
        }

        $this->readOnly = true;

        fflush($this->fp);
        fclose($this->fp);
        if (!@rename($this->tmp, $this->file)) {
            throw new RuntimeException("Cannot move the temporary file");
        }
        return $this->file;
    }