Fix closing imperative figures.
Add line plot to imperative api