The visible binding cannot work properly with the Window widget, because it represents simple hiding and showing of a single DOM element - the Window wrapper. As a result, any required accompanying scripts are not executed and the Window even doesn't "know" that is hidden.
You need to implement a custom MVVM binding, which uses the viewModel's refresh event, checks the isVisible value and opens/closes the Window via its API methods.