adding the ability to save the hgraph state to an output file