Possible race condition when using updateWithStart

Hello I’m wondering if there is a race condition in the following code using updateWithStart:

boolean globalReturn = false;

public String workflow() {
  // activities...

  // Complete workflow
  globalReturn = true;
  return "wf done";
}

public String updateWithStartHandler() {
  Workflow.await(() -> globalReturn);
  return "update done";
}

An external service starts the workflow using updateWithStart and is now waiting on the update handler to finish. The update handler is waiting on the global flag to be set. The workflow runs all it’s activities and just before returning it sets the flag and immediately returns. Is there a race condition where even though the flag is set to break the await and complete the update handler, the workflow may complete before the update actually finishes causing an exception because the workflow completed before all handlers are finished? Do I need to add Workflow::isEveryHandlerFinished on the workflow before returning?

Or is the update guaranteed to finish since the completion of the workflow and the breaking of the update’s await is a part of the same workflow task?

Following up on the above question.