service: Close socket in exception-safe way.

That is, avoid leaving open socket fd if exception is thrown in receive
loop.