In first example you extract the figure object and in the second one you don’t.
Btw if some the title is cut off or something similar add bbox_inches="tight"
To save the current figure object you can use just plt.savefig
plt.savefig(filename, dpi=200, bbox_inches="tight")
To close open figures you can use
plt.close("all")