U.S. stocks closed higher on Tuesday as technology came back from their biggest two-day decline since December.