Closing properly the pool in the Sample function ath the end of the run.

The pool is closed only if it was created by the emcee module.

When runing a sampler with threads different from 1 in a ipython notebook,
the pool was not closed properly and everytime I was using the sampler, a
new pool was added and not close.
This close the pool at the end of the run.