How can I set up an exit to close the app?

How can I set up an exit to close the app?

What's the best way to let the user close the app? I saw an example of an exit popup screen in the documentation, but there must be more to it than just the popup. Does some script have to be added somewhere?

When I try backing out of my app, it just brings up the splash screen and then the app comes back on.

Thanks for any help.