free socket after error