CA-148234: Don't leak socket if fixing cookie fails

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #2001 from simonjbeaumont/ca-148234

CA-148234: Don't leak socket if fixing cookie fails