An indirect pseudospectral method for the solution of linear-quadratic optimal control problems with infinite horizon