move isShown=false before the digest on hide

In my opinion, the digest should be run after isShown is set to false, otherwise external watchers will not hear about it.