S&P 500, Nasdaq rise as Apple nears $2 trillion in market cap