File opener is open after hitting backbutton of mobile phone

Hi,
I have a issue this is my function for download and open the pdf file in mobile app

letProcessReportCard(Url) {
var currentDate = new Date();
var currentTimeStamp = currentDate.getTime()
let path = this.file.dataDirectory;
const transfer = this.transfer.create();
transfer.download(Url, path + ${currentTimeStamp}.pdf).then(entry => {
this.hideLoader();
let url = entry.toURL();
console.log(‘the url is as’, url);
if (this.platform.is(‘ios’)) {
this.document.viewDocument(url, ‘application/pdf’, {});
}
else {
this.fileOpener.open(url, ‘application/pdf’)
.then(() =>
console.log(‘File is opened’))
.catch(e => console.log(‘Error opening file’, e));
}
});
}

in this code when i click on submit button loader is start until the file downloaded from the server and hide loader after download then open file using file opener workd perfectly but if i click on submit button loader starts and if i click on back button loader stop but the file still open after few seconds. I want to stop to open the file if user click backbutton between downloading the file. please help

todo like this

fetch(‘data:application/pdf;base64,’ + this.downloadPDFStream, { method: “GET” }).then(res => res.blob()).then(blob => {
this.file.writeFile(this.file.externalApplicationStorageDirectory, this.fileName, blob, { replace: true }).then(res => {
this.FileResponse = res;
/this.fileOpener.open(res.toInternalURL(), ‘application/pdf’).then((resFileOpener) => {
//this.prepareToPrint(“data”);
}).catch(err => { console.log(‘open error’) });
/
loading.dismiss();
this.socialsharing.share(“test”, null, this.FileResponse.toInternalURL().replace(“cdvfile”, “file”), null);
}).catch(err => {
console.log(‘save error’);
loading.dismiss();
});
}).catch(err => {
console.log(‘error’);
loading.dismiss();
});

cheers!!