It's not odd at all. This kind of situation is most likely a timing issue, especially since you say the VI works in highlight mode. This means that the VI is sending out the commands too quickly, and the motor is probably ignoring them. When you run in highlight mode there is a considerable delay between commands. Insert some wait between commands. The manual for the motor should tell you how long to wait. If it doesn't, start with a reasonable guess.
Additional comment: There is no need to open/close the VISA session multiple times. You only need to open it once at the beginning and close it at the end.