S&P 500 tech index edges toward $5 trillion while Apple steals spotlight