The way I see it, had the referee immediately announced Morocco as the winner the second Senegal left the pitch, it would have been fine. However, since he allowed the game to continue, only the final result matters. This is therefore the only correct decision.