vmem: fix possible attempt to unlock a mutex that is not locked