A forecast horizon and a stopping rule for general Markov decision processes