bugfix: ensure releasing the lock when returning prematurely

in the select()-based implementation.