close the socket before exiting

Signed-off-by: Mattias Andrée <maandree@operamail.com>