Fixed to dismiss the ProgressDialog when a process exits before showing
any windows.