US stocks close higher as investors shake off inflation-fueled rout