1, Killed or ran out all the terrorists in Afghanistan. At least those out to hit the US homeland including "bin Laden". If a terrorist is one who targets US civilians they're not there (as a side note).
2, Had the TAPI pipeline approved. This screwed Iran and China. India strategicaly weakened by the deal will likely draw closer to the US. Pakistan is a mixed bag fraught with problems (as usual). LNG and shipping got a boost and will leave who ever owns the sea (the US) in a more powerful position.
3, Built a relationship with a new political, military, and business elite in Afghanistan. Many are likely retain some influence after withdrawal. This will leave an access point for influence and Intelligence.
No permanent bases and fully uncontested mineral access? Awe shucks to bad. There are countless downsides to staying, particularly engaged, and they're pretty out in the open.