In addition to another answer, you can:
set term pop
set output
In general, you can save the terminal settings that you are currently using using:
set term ...
set term push
set term ...
set term pop
However, as described in help set terminal:
set term push , set term pop . save term load term, . , . gnuplot startup . set term pop , .