Pakistan, Afghanistan working closely to punish masterminds of APS attack: Nisar