S&P 500, Nasdaq Post Weekly Gains on Tech Strength