provider: Remove provider if there is an error when connecting