code: def test_ggsave_closes_plot():
      assert plt.get_fignums() == [], "There are unsaved test plots"
      fn = next(filename_gen)
      p.save(fn, verbose=False)
      assert_exist_and_clean(fn, "exist")
      assert (
          plt.get_fignums() == []
      ), "ggplot.save did not close the plot"
  
imports: import warnings
  from pathlib import Path
  import matplotlib.pyplot
  import pandas
  import pytest
  from plotnine import aes, facet_wrap, geom_point, geom_text, ggplot, ggsave, theme_xkcd
  from plotnine.data import mtcars
  from plotnine.exceptions import PlotnineError, PlotnineWarning
label_desc: Use image node_id 3 for calling a global function with example usage: test_ggsave_closes_plot() without return types