handle Back Press
Handles a back press with the same layered logic as the regular SDK: dismisses the contextual toolbar first if one is shown; otherwise closes the active overlay view (thumbnail grid, outline, etc.).
Prefer this over exitCurrentState in a BackHandler so that pressing back while both an overlay view and a contextual toolbar are open only closes the toolbar, leaving the view open.