Fixing flakiness in PeerConnectionIntegrationTest.

EndToEndConnectionTimeWithTurnTurnPair was failing intermittently due to
a DCHECK being hit in ports.cc. This was caused by the ScopedFakeClock
being destroyed before the ports. The ports miscalculated a large
negative number for the rtt of a STUN request/response due to the global
clock changing. This fixes the problem by closing the PeerConnections
before the ScopedFakeClock goes out of scope.

Bug: webrtc:9422
Change-Id: Ia4aa3f638dff5da4317a35cf1514ec61472d0d74
Reviewed-on: https://webrtc-review.googlesource.com/84241
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23670}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index 7de0ad6..c30ecef 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -3038,6 +3038,11 @@
   MockDataChannelObserver new_observer(callee()->data_channel());
   EXPECT_EQ_SIMULATED_WAIT(data, new_observer.last_message(), kDefaultTimeout,
                            fake_clock);
+  // Closing the PeerConnections destroys the ports before the ScopedFakeClock.
+  // If this is not done a DCHECK can be hit in ports.cc, because a large
+  // negative number is calculated for the rtt due to the global clock changing.
+  caller()->pc()->Close();
+  callee()->pc()->Close();
 }
 
 // This test sets up a call between two parties with audio, video and but only
@@ -3934,6 +3939,11 @@
   caller()->CreateAndSetAndSignalOffer();
   EXPECT_TRUE_SIMULATED_WAIT(DtlsConnected(), total_connection_time_ms,
                              fake_clock);
+  // Closing the PeerConnections destroys the ports before the ScopedFakeClock.
+  // If this is not done a DCHECK can be hit in ports.cc, because a large
+  // negative number is calculated for the rtt due to the global clock changing.
+  caller()->pc()->Close();
+  callee()->pc()->Close();
 }
 
 // Verify that a TurnCustomizer passed in through RTCConfiguration