bullet-proof socket shutdown