Replace provider hardcoded path with helper.

Also reorder some imports and remove unused ones.
Handle wizard close correctly. Closes #4986.

- Refactor connection and disconnection from backend.
Add changes file for #4986.
Merge remote-tracking branch 'refs/remotes/ivan/bug/4986_error-joining-string' into develop