Maya Crash During Extract Import Reference

Actually, it seems to crash here.

Which would mean that this would already crash:

from maya import cmds

reference_path = r"path/to/output.ma"
_scene_type = "mayaAscii"  # or "mayaBinary"

cmds.select(all=True, noExpand=True)
cmds.file(reference_path,
          force=True,
          typ=_scene_type,
          exportSelected=True,
          channels=True,
          constraints=True,
          shader=True,
          expressions=True,
          constructionHistory=True)

Does that crash in your maya session? If so, sounds like a Maya bug.