Instead of
bpy.ops.wm.call_menu_cancel()
use
context.window.screen = context.window.screen
Explanation:
Assigning the screen (it can be the same one), generates an NC_SCREEN notify code in Blender’s event system, which causes Blender to remove any active ui popup handlers on the window. This includes any open menus, floating panels/dialogs, and pie menus.