close method
Rejects further requests, then waits for the in-flight ones to finish before closing every connection.
A request counts as in-flight until its response body ends or is cancelled, so a caller holding a response it never reads will keep a connection open. Shutdown runs in the background, so this never blocks on that.
Implementation
@override
void close() {
_closed = true;
_shutdown ??= _closeAll();
}