TS-3156: fix mutex crashes

MUTEX_LOCK and MUTEX_TRY_LOCK expect to be passed a Ptr<ProxyMutex>.
Change direct uses of ProxyMutex to Ptr<ProxyMutex> so the underlying
mutex is not destroyed early.