async function shouldFailOnResultWhenClosed (
    protocolVersion,
    runnable,
    selectObservable,
    closeFunc
  ) {
    if (protocolVersion < 4.0) {
      return
    }

    const result = runnable.run('RETURN 1')
    await collectAndAssertEmpty(closeFunc())

    const expectedError = jasmine.objectContaining({
      message: jasmine.stringMatching(/Cannot run query/)
    })
    await collectAndAssertError(selectObservable(result), expectedError)
  }
@param {number} protocolVersion
@param {RxSession|RxTransaction} runnable
@param {function(RxSession|RxTransaction):Observable<any>} selectObservable
@param {function(): Observable} closeFunc