Clean up connection state.