Close transport when the connection is closed.
Close all transports in unittests.