Clean up the rendering thread on exit.

When terminating the render thread, the thread is detached and the renderer
is deleted.