Update kiaic.c

Close socket if disconnected