prevent socket double closing