S&P, Nasdaq post 5th straight weekly gains