Add a missing mutex lock/unlock.

Spotted by dhill.