Approximating the solution of stochastic optimal control problems and the Merton's portfolio selection model