Amazon stock closed near a record high after AI bets and layoffs