Fix posix event mutex lock bug

The mutex must be unlocked regardless of what the return value is or it
will be locked forever if the return value isn't 0.