Future<void> close({bool keepOpen = true}) async { await _stateStream.close(); if (!keepOpen) { await _sock.close(); } }