More robust way to wait for finalization

Change-Id: I99aa3ac27c5157a6858978da20e480bc9847d88f