fixed the cleanup code when the credential factory fails to create a builder