Can we have custom code to run when editor shuts down, but not when game shuts down?

I would like to call some custom network code when the editor shuts down, not when the game shuts down. I tried creating a custom GameInstance and overriding Shutdown(), but it gets called when the game shuts down.

Is there anyway to have code that only runs when the editor shuts down?

EDIT: I found the solution! I had to inherit from UUnrealEdEngine, set the new class in DefaultEngine.ini, then override FinishDestroy().