code: def close_fileoutput (self):
          
          if self.fd is not None:
              try:
                  self.flush()
              except IOError:
                  # ignore flush errors
                  pass
              if self.close_fd:
                  try:
                      self.fd.close()
                  except IOError:
                      # ignore close errors
                      pass
              self.fd = None
docs: Flush and close the file output denoted by self.fd.