Wait thread stop before delete