Fix deadlock on BSD

The removeWatch routine could return without releasing the lock on
w.bufmut. This change unlocks the mutex before checking for errors.