z matrix plotting has broken variable name

Also don't leave a broken dangling plot window around. 
We're saving to a file, so clean up the screen.