Waits for a current transaction to finish in TEST_CompactRange when the `background_work_finished_signal_` signal may be emitted due to an error. This is a prospective fix for flaky crashes observed in b/351680196#comment5. PiperOrigin-RevId: 663457574pull/1/head