(self)
return succeed(self.downloader.close())
Gracefully close the execution engine.
        If it has already been started, stop it. In all cases, close the spider and the downloader.
Gracefully close the execution engine.
        If it has already been started, stop it. In all cases, close the spider and the downloader.
Gracefully close the execution engine . If it has already been started stop it . In all cases close the spider and the downloader .
def close(self) -> Deferred:
        """
        Gracefully close the execution engine.
        If it has already been started, stop it. In all cases, close the spider and the downloader.
        """
        if self.running:
            return self.stop()  # will also close spider and downloader
        if self.spider is not None:
            return self.close_spider(self.spider, reason="shutdown")  # will also close downloader
        return succeed(self.downloader.close())
def close ( self ) -> Deferred : if self . running : return self . stop ( ) # will also close spider and downloader if self . spider is not None : return self . close_spider ( self . spider , reason = "shutdown" ) # will also close downloader return succeed ( self . downloader . close ( ) )