TRQ-2408 scan_for_terminated needs to be on its own thread.

We were able to solve this problem without putting scan_for_terminated
on its own thread. We modified scan_for_terminated so it would not
update every job each time scan for terminated had been called. It
now only updates jobs that are finished and it only updated finished
jobs one time.
Merge branch '4.5-dev' of https://github.com/adaptivecomputing/torque into 4.5-dev