This fixes #1226 (closed) ,
I've changed the logic following the following points:
# It is a deadlock when:
# 1. There are no more non-wrapped jobs in ready status
# 2. And there are no more jobs in the queue ( submitted, queuing, running, held )
# 3. And all current wrappers being processed at this time are not wrappable.
The unit test seems to work fine with this version as well