MM asks the XY stage if it is busy, and only takes an image when the stage reports it is no longer busy, or when a time-out occurs. Without further information it is difficult to know which of these situations occurred, but since you say this only happens after long movements, I believe that a time-out occurred. To set a longer timeout, change the property Core-TimeoutMs, and set it to something larger than the longest time it ever takes for your stage to move to a new position. It is useful to add this timeout to your System-Startup configuration.
There are other possible reasons why the stage is still moving (for instance, some stages can report they are done moving, but then decide to make a tiny adjustment after all, tricking MM in taking a picture while the stage moves). To see for yourself what is actually happening, choose Help > Report a Problem, reproduce the issue, and look at the System logs to find out the root cause. If thing are too complicated, you can send the error report and someone will get back to you.