Reorder finalization to avoid potential crash; ref
`mrb_gc_destroy` may call other mruby API functions from the finalizers.
So call that function first.
MODIFY
src/state.c
src/state.c
@@ -221,10 +221,10 @@ mrb_close(mrb_state *mrb)
}
/* free */
- mrb_gc_free_gv(mrb);
+ mrb_gc_destroy(mrb, &mrb->gc);
mrb_free_context(mrb, mrb->root_c);
+ mrb_gc_free_gv(mrb);
mrb_free_symtbl(mrb);
- mrb_gc_destroy(mrb, &mrb->gc);
mrb_free(mrb, mrb);
}

Reorder finalization to avoid potential crash; ref #4618

`mrb_gc_destroy` may call other mruby API functions from the finalizers.
So call that function first.