close socket in sender on shutdown