xxxxxxxxxx
close() by itself closes the current figure
close(h) where h is a Figure instance, closes that figure
close(num) closes figure number num
close(name) where name is a string, closes figure with that label
close('all') closes all the figure windows
xxxxxxxxxx
from matplotlib import pyplot as plt
fig = plt.figure()
ax = fig.add_subplot()
plt.show()
plt.close()