code: def end_output (self, **kwargs):
          
          self.stats.downloaded_bytes = kwargs.get("downloaded_bytes")
          self.stats.num_urls = kwargs.get("num_urls")
          if self.has_part('stats'):
              self.write_stats()
          if self.has_part('outro'):
              self.write_outro(interrupt=kwargs.get("interrupt"))
          self.close_fileoutput()
docs: Write end of output info, and flush all output buffers.