public function close()
    {
        if (null !== $this->contents) {
            $result = file_put_contents($this->filename, json_encode($this->contents));
            if (false === $result) {
                throw new IOException('Unable to write to file!');
            }
            $this->contents = null;
        }
    }
public function close()
    {
        if (null !== $this->contents) {
            $result = file_put_contents($this->filename, json_encode($this->contents));
            if (false === $result) {
                throw new IOException('Unable to write to file!');
            }
            $this->contents = null;
        }
    }
public function close ( ) { if ( null !== $ this -> contents ) { $ result = file_put_contents ( $ this -> filename , json_encode ( $ this -> contents ) ) ; if ( false === $ result ) { throw new IOException ( 'Unable to write to file!' ) ; } $ this -> contents = null ; } }
Writes any pending changes to the opened json file
and disposes of the class.

If this object wasn't opened, then this method will do nothing.
@return void
Writes any pending changes to the opened json file and disposes of the class .