Exiting Gnuplot

Gnuplot will stop when it receives the command
     quit
or when it reaches the end of the script it is reading, or (interactively) when control-D is pressed.

Note: When the program stops running, any open X-windows will be closed. To prevent this, use the "-persist" command-line option when starting gnuplot.