Port citra-emu/citra#7146: "assert/logging: Stop the logging thread and flush the backends before crashing"