make case processing more transactional

acquire a lock for all case docs as they are fetched
and release all locks when complete