Fix possible mutex lock/unlock mismatch

fixes #257
2 files changed