Why are my threads getting deleted?