Maybe you are not doing anything wrong. I followed your example and it worked fine for me. No crash. If I request "Open with SQL Developer" I do see this failure in the the CMD console:
It is unable (Windows 10, not running as administrator, if that even matters) to create the file association.
So you are saying that, after the crash, if you restart SQL Developer the Preferences File Types do not show that .trg got saved and that opening a .trg file does not open it in the Code Editor?