Unlock the global mutex when returning after a failure.
Merge pull request #30 from nemequ/master

Unlock the global mutex when returning after a failure.