'This method is called when the process ends normally or by an error.'

def scan_end_hook(self):

    self.worker_pool.terminate_join()
    try:
        om.manager.end_output_plugins()
    except Exception:
        raise
    finally:
        self.exploit_phase_prerequisites()
        self.plugins.zero_enabled_plugins()
        self.target.clear()
        stop_profiling(self)
        parser_cache.dpc.clear()
        self.status.stop()
