Fix an unpaired mutex unlock

This may have been causing the random memory corruptions. Whoops.
Merge pull request #5 from pwithnall/locking-bug

Fix an unpaired mutex unlock