Afghan war did not end on terms US wanted with Taliban: Top general