It is not possible to debug this program because it's dependent on your specific MQ environment. You need to get this down to a small, self-contained script that reproduces the problem.
One problem I do see is that the main thread can terminate before the threads are finished. You need the following at the end of your script: