Fix an unpaired mutex unlock

This may have been causing the random memory corruptions. Whoops.