Optimizing Chain-of-Thought Confidence via Topological and Dirichlet Risk Analysis