'Close the associated FITS file and memmap object, if any.
Parameters
output_verify : str
Output verification option.  Must be one of ``"fix"``,
``"silentfix"``, ``"ignore"``, ``"warn"``, or
``"exception"``.  May also be any combination of ``"fix"`` or
``"silentfix"`` with ``"+ignore"``, ``+warn``, or ``+exception"
(e.g. ``"fix+warn"``).  See :ref:`verify` for more info.
verbose : bool
When `True`, print out verbose messages.
closed : bool
When `True`, close the underlying file object.'

def close(self, output_verify='exception', verbose=False, closed=True):

    try:
        if (self._file and (self._file.mode in ('append', 'update')) and (not self._file.closed)):
            self.flush(output_verify=output_verify, verbose=verbose)
    finally:
        if (self._file and closed and hasattr(self._file, 'close')):
            self._file.close()
        for hdu in self:
            hdu._close(closed=closed)
