Side menu with back button click ,app will be closed

when i go with views normally on button click and click back button on android its comming correctly until my homepage.
but when i click side menu and go to next 2 pages and click back button ,before homepage app will be close.
why is that?

home -> 2nd page -> 3rd page
sequence from button clicks

At what point will it close? It’s very important information.

after click the side menu and go forward.when we go step by step will be close in side menu clicked step.