When you close MT4 terminal, the EA also stops running. The EA needs to be running on the same computer, and the MT4 terminal needs to be open for it to function.