Stop and unref this.
When no threads are using the mainloop, the thread will be stopped and the final ref to this will be released.
a Thread