Previous page within sideMenu

Hey guys, I use the sideMenu template from Ionic 4 and I notice if you navigate all the page and later press the button back from your device, this backward page by page until reach the first.
The same problem are in the Tabs template.
What I need to config to avoid this?
I want close the app instantly or back to a login page when the user press the back button in the menu page.
Thank you so much, I’m new with this framework and sorry by my bad english.