wpdb: When flushing results on a mysqli connection, make sure that `wpdb::$dbh` is a valid mysqli connection handle.

Fixes a unit test failure introduced in [30297].

Fixes #28155.

Props soulseekah.



git-svn-id: https://develop.svn.wordpress.org/trunk@30299 602fd350-edb4-49c9-b593-d223f7449a82