He arrived after dusk at Bagram air base , met with Afghan and U.S. officials at the presidential palace in Kabul , then spoke to a cheering crowd of U.S. soldiers back at Bagram before flying out of the country before dawn .