close scope after dispatched is called