[runtime] Wait for the finalizer thread to exit in both code paths where waiting for it succeeded.