BF: Properly close the socket before the context gets gc’d.