If input streams are nested (inherited load scripts), then reading will continue in the parent stream. When the top level stream is closed, the program itself will exit.
The command exit gnuplot will immediately and unconditionally cause gnuplot to exit even if the input stream is multiply nested. In this case any open output files may not be completed cleanly. Example of use:
bind "ctrl-x" "unset output; exit gnuplot"
See help for batch/interactive (p. ) for more details.