Merge pull request #297 from frida/fix/error-path

Fix error path so mutex is unlocked before returning