Azhar leads Pakistan fightback as Hafeez calls time on Test cricket