Popup issue

Hey everyone,I’m creating an app in ionic , in this app i called an multiple(5) rest services on one submit button. If all service are return an error at that time i’m shown an popup message for every service . when return an error from service popups are not closed.I’m using a code for popup is

var popup=$ionicPopup.show({
buttons: [{
text: ‘OK’, type: 'button-positive

Please help to how to close the popup.

Thanks in advance…