rpc: check if a socket is valid before attempting to close it

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
rcld: Support removing nodes from the cluster
 * Gracefully remove a node from an arbitary position in the cluster
 * Replace the removed node with the last one

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>