S&P, Nasdaq post 3rd straight weekly loss