fix an annoying abstraction violation in uth

this also wasn't using locking correctly: it never released the locks
Merge pull request #3966 from dimagi/fix-uth

fix an annoying abstraction violation in uth