Try by adding close page
The reason you're seeing this kind of behavior is because the page you go to after selecting "Cancel" on your pop up has an object that is no longer in context, meaning the page parameter object has been deleted or removed from working client side memory. This makes sense, because the default behavior of those cancel buttons, especially on New/Edit pop up pages is to cancel your changes. Cancelling your changes in Mendix means wiping everything that hasn't been saved to the database or committed to working memory for NPE's.
A way to fix this would be to:
1. Commit whatever primary entity is on the main page you navigate back to after hitting "Cancel" or
2. Override the default behavior of the cancel button on your pop up to just close your page or run some custom logic in a microflow or nanoflow.
Hope this helps,