only close the transport when we need to