'Close the execution engine gracefully.
If it has already been started, stop it. In all cases, close all spiders
and the downloader.'

def close(self):

    if self.running:
        return self.stop()
    elif self.open_spiders:
        return self._close_all_spiders()
    else:
        return defer.succeed(self.downloader.close())
