PR#3342 fix resource leak coverity issue 966577
coverity 966576 - close socket in error path