For multi-page output in PDF (and presumably PS?), operations which call refreshCurrent will cause an additional page to be included in the PDF.
For instance, using gnuplot.grid(true) will cause two plots (both with grids enabled) to appear. Commenting out line 894 obviously circumvents this, as does using gnuplot.raw('show grid') instead.