US stocks close higher as tech shares drive gains