I did some automation stuff for my work and had to save a generic number of graphs here is the sytax chunk for saving and closing the data table and window.
I used a Oneway graph for my analysis, but insert the code for your specific graph in the Oneway part. You can save the auto generated script and then insert that code into the Window. If you need help on that let me know, but there should be some thread addressing that in the forums.
This one was hard for me to figure out, but you have to use the child function. After you create the window variable you have to access the box that contains the name and then set the title. Here is the syntax:
wind = New Window( fileName, blah blah);
overies = wind << Child( 1 );
overies << Set Title( "Charts Suck!!" );
Or set it to what you want, or not, im not a mind reader.