TRQ-3013. Fix a deadlock.

We caught an instance where the job was locked and we tried to lock a queue. This violates the
locking hierarchy where a queue must be locked before a job.
TRQ-3013. Fix a syntax error.