Reset all logging locks in HeadlessWorker.

This works around an unfortunate interaction between the subprocesses
started in multiprocessing and the threads started in multiprocessing.
If the main thread is logging and is in a critical section when
the multiprocessing worker-forking thread forks a worker, the child
will inherit the lock but no code to ever release it.  Since HeadlessWorker
is run only in the distributed worker children, reset logging's locks there
before moving on.

See also: http://bugs.python.org/issue6721