implement socket close function

Signed-off-by: Corentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>