pub fn stop_recording()
Stops recording and flushes.
Note that this is called automatically on process exit.