In MT5, not all positions are closed at the same time. At first, the most unprofitable position is closed. If after it's been closed, the Margin Level becomes higher than the Stop Out level, then the rest of the positions will not be closed.
If not, then the next least profitable position will be closed (following the same principle), until the Margin Level becomes higher than the Stop Out level.