Although this is not strictly a bug, I think it would be better to use `defer` to unlock the mutex, since the this not a performance critical section of code. By doing this, we will reduce the chance of introducing a bug if and when we come to change anything in this area.