Probably more correct is to keep this code in the 'Main' module ...
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
End Sub
and in your Pages class module handle the back key in the Close_Request event.
Sub B4XPage_CloseRequest As ResumableSub
Return True
End Sub
ps: strangely , In a similar scenario test app, passing
Return False did not cause a crash (as in your case) , just made back key unresponsive.