added a line to close the figure after saving