Ashraf Ghani wins second term