bfgtls: Implement destructor to free memory when threads exit

Conflicts:
	util.c