Cleanup thread class