close the socket before existing

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