     }
     call.messageQueueEmpty.wait()
   }
+
+  let closeSem = DispatchSemaphore(value: 0)
+  try call.close {
+    closeSem.signal()
+  }
+  _ = closeSem.wait()
 
   // Receive pongs
   for _ in 0..<steps {

        let messageString = String(data: data, encoding: .utf8)
        XCTAssertEqual(messageString, serverPong)
      } else {
        print("unexpected result: \(callResult)")
      }
      pongSem.signal()
    })

  verify_metadata(initialMetadata, expected: initialClientMetadata)

  let initialMetadataToSend = Metadata(initialServerMetadata)
  let sendMetadataSem = DispatchSemaphore(value: 0)
  try requestHandler.sendMetadata(initialMetadata: initialMetadataToSend) { _ in
    _ = sendMetadataSem.signal()
  }
  _ = sendMetadataSem.wait()
  
  // Receive remaining pings
  for _ in 0..<steps {
    let receiveSem = DispatchSemaphore(value: 0)
    try requestHandler.receiveMessage(completion: { callStatus in
      let messageString = String(data: callStatus.resultData!, encoding: .utf8)
