Reset thread before panicking

Before panicking, it is simpler to reset the thread instead of closing
its variables and adjust the top manually.
3 files changed