The U.S. military will remain involved in the Afghanistan war into September, keeping the option of launching airstrikes against the Taliban to defend Afghan forces, U.S. officials said Thursday, even as the final combat troops prepare to leave the country in coming days.