The agent turns to the opposite side at the end of a route

Hello, sometimes when reaching the end of the route, the agent turns to the opposite side.
Here’s a demo:

How can i fix this?