Fixes a bug where we'd leak a goroutine in state.run when the given context was canceled while there was a pending update.