Fixed bug where remote socket close did not reflect in internal state.