Pellet fuelling with edge-localized modes controlled by external magnetic perturbations in MAST