'Gracefully stop the pool.'

def on_stop(self):

    if ((self._pool is not None) and (self._pool._state in (RUN, CLOSE))):
        self._pool.close()
        self._pool.join()
        self._pool = None
