fix some problems with the progress dialog for remote calls.
do not close the dialog too early, wait for the thread to finish, after cancel and after error