Fix thread warning exit realtime

Stops any active realtime threads before exiting to
suppress the warning messages about active threads.