'Closes the file pointer, if possible.
This operation will destroy the image core and release its memory.
The image data will be unusable afterward.
This function is only required to close images that have not
had their file read and closed by the
:py:meth:`~PIL.Image.Image.load` method.'

def close(self):

    try:
        self.fp.close()
        self.fp = None
    except Exception as msg:
        logger.debug('Error    closing:    %s', msg)
    if getattr(self, 'map', None):
        self.map = None
    self.im = deferred_error(ValueError('Operation    on    closed    image'))
