Notification.Close() is not closing

I’m running into some strange behavior and can’t figure out why the calls to update the UI is not happening. When a button is clicked a notification is opened and displays while an async command is running on a background thread. After the command completes, a callback is called to update the UI and closes the notification. The UI sometimes doesn’t update and the notification never closes, but the methods are being invoked without error and the print statements after the calls to update the UI are working. Not sure what’s going on exactly, is the session deadlocking? I’m using Vaadin 16. Thanks in advance for your support!

Update: I removed the call to updateUI and have tried accessSynchronously but no luck either.

public void onNextClick() {
	myCommand.invoke(); // Invoke async command (com.google.common.util.concurrent.AsyncFunction)
	parent
			.getUI()
			.ifPresent(
				ui ->
					ui.access(
						() -> {
						  notification = NotificationFactory.createSpinnerNotification();
						  notification.open(); 	// Open spinner notification while command is running on background thread
						}));
}

public void onNextCallback(boolean isValid) {
// When command is complete, this callback function is called
	updateUI(); // Update view's components
	// Close notification
	parent
			.getUI()
			.ifPresent(
				ui ->
					ui.access(
						() -> {
						  if (notification != null) {
							notification.close(); // Does not work
							System.out.println("CLOSE"); // Console prints stdout - Yes this works
						  }
						}));
}

public void updateUI(){
parent
			.getUI()
			.ifPresent(
				ui ->
					ui.access(
						() -> {
						  // Update other UI components - does not work
						  System.out.println("UPDATE"); // Console prints stdout - Yes this works
						}));
}

I didn’t realize that the push mode was set to MANUAL rather than AUTOMATIC. Switching to AUTOMATIC fixed my problem. However, I am still confused on the non-deterministic behavior of MANUAL mode and why updateUI would fail most times, but then sometimes work.