S&P, Nasdaq close higher to post longest winning streak in 2 years