U.S. stocks closed higher in response to the July consumer price inflation report, which came in cooler than expected.