soket now closed correctly ( in error cases)