Refactor rarch_main_deinit_core