US stocks inch up as indexes close in on big yearly gains