make socket cleanup dry