Implicit Finite-Horizon Approximation and Efficient Optimal Algorithms for Stochastic Shortest Path