class_docstr: Incremental image parser.  This class implements the standard
  feed/close consumer interface.
docstr: (Consumer) Close the stream.
  
  :returns: An image object.
  :exception OSError: If the parser failed to parse the image file either
                      because it cannot be identified or cannot be
                      decoded.
docstr_tok: ["(","Consumer",")","Close","the","stream",".",":","returns",":","An","image","object",".",":","exception","OSError",":","If","the","parser","failed","to","parse","the","image","file","either","because","it","can","not","be","identified","or","can","not","be","decoded","."]
code: def close(self):
      """
      (Consumer) Close the stream.
  
      :returns: An image object.
      :exception OSError: If the parser failed to parse the image file either
                          because it cannot be identified or cannot be
                          decoded.
      """
      # finish decoding
      if self.decoder:
          # get rid of what's left in the buffers
          self.feed(b"")
          self.data = self.decoder = None
          if not self.finished:
              msg = "image was incomplete"
              raise OSError(msg)
      if not self.image:
          msg = "cannot parse this image"
          raise OSError(msg)
      if self.data:
          # incremental parsing not possible; reopen the file
          # not that we have all data
          with io.BytesIO(self.data) as fp:
              try:
                  self.image = Image.open(fp)
              finally:
                  self.image.load()
      return self.image
  
imports: import io
  import itertools
  import struct
  import sys
  from .None import Image
  from ._util import is_path
label_desc: Use image node_id 5 for calling the Parser obj's underlying member method code with example usage: obj.close() and returns: self