onDock is tied to the onShowing stage.apply() init. I generally use onShown for my initialization because that's when the Stage is actually on the screen and available to handle a progressbar. So, try moving your code to the onShown() handler
primaryStage.setOnShown {
evt ->
runAsync {} ...
}