code: def test_save_as_pdf_pages_closes_plots():
      assert plt.get_fignums() == [], "There are unsaved test plots"
      fn = next(filename_gen)
      with pytest.warns(PlotnineWarning):
          save_as_pdf_pages(p(), fn)
      assert_exist_and_clean(fn, "exist")
      assert (
          plt.get_fignums() == []
      ), "ggplot.save did not close the plot"
  
file_path: plotnine/tests/test_save_as_pdf_pages.py
imports: import warnings
  from pathlib import Path
  import matplotlib.pyplot
  import pytest
  from plotnine import aes, geom_text, ggplot, ggtitle, theme
  from plotnine.data import mtcars
  from plotnine.exceptions import PlotnineError, PlotnineWarning
  from plotnine.ggplot import save_as_pdf_pages
label_desc: Use image node_id 4 for calling a global function with example usage: test_save_as_pdf_pages_closes_plots() without return types