Correctly stop and close recovery threads and cleanups global context.

Also decreased total number of threads and processes created and used by pytests.
Why do you make ctx global first, and only then setup monitor and process pool? Who can access global context until.it is fully initialized?