evgeniiromanov unfortunately this peace of code is not enough to debug the issue.
I just opened one of my demo scenes Perspective_And_TopDown_Demo
I click on a cube to follow, then stop the animation on the cube. The camera will stop following, and there is no weird thing happening.
If you want me to debug this, I will need a unitypackage that isolate the issue, or we can book a call after I'm back from vacations.