One possible explanation is that for US accounts positions have to be closed in the order they were opened (FIFO).
Routine scripts do not take this into account and therefore try to close positions indiscriminately. FIFO would require a special type of script that closes positions in the order. I haven't found one in MT4 codebase. But it's an idea for someone who can program it.
Should be a matter of entering a trade number such as magic number=magic number+1, etc. Don't let me make a fool of myself completely. I'll stop here.

Ciao,

G