function close() { if ($this->stream) { fflush($this->stream); fclose($this->stream); } parent::close(); }