fixed issue for close inthread db.