Avoid memory leak

Don't hold strong references to threads, as these can prevent threads being
garbage collected properly.