2.8x Render with gui crash

I have a script that displays the render view dialog and renders the scene. However Ive found out it crashes blender when the render is completed.
If I dont use the gui, the user has no idea whats happening, but it prevents blender from crashing.

What solutions do people use to get around this bug?

# crash
bpy.ops.render.render('INVOKE_DEFAULT')

# crash free, but no gui
bpy.ops.render.render()