RobotStudio event

Problems with restarting EGM communication

I have an application (running on a computer with Ubuntu) for
moving the ABB robot by EGM. In this application, I start EGM communication,
send points to the robot and stop it when movement is complete. Between
EGM movements I also use RWS communication (for moving the robot). In some
cases application starts EGM very soon after stopping it (about 2s) and I
observe strange robot behavior in this situation - the first thing the
robot does is try to move to the position where it finished the last EGM
movement. It happens even when I only start and stop EGM and then start
it again (without sending any positions via EGM at all). I have
'egmstopmode' set to EGM_STOP_HOLD. While debugging I noticed that the robot
sends packages to the PC for about 1700ms after calling EGMStop.

I would like to know what is the reason for this behavior and if it is
possible to restart EGM so quickly or I should rather implement this
flow in a different way.