isKinematic = true kicks in but physics keep on going for one animation loop.

I have a character with rigidbody2d, animator and mesh with rig. When I use animation event to change isKinematic I can see it kicks in right away, but sometimes it loops the animation once more before the isKinematic kicks in. isKinematic is true the whole time but has no effect until the animation ends. Animation has no y-plane root motion(idle animation on ledge)

Okay I think I solved it. Seems like the rigidbody2D stored the velocity and kept on going for some reason. Solution was to zero it out like this

rb.velocity = new Vector3();

when ever I need the kinematic to work while moving