Add explicit error instead of 'nil' when disconnecting socket