Handle history file and output directory properly

1. When running a graph with exception handling, if no output is generated
we should store nothing in the history file.  This change makes sure
that the history file exists by writing blank json if it does not.  It
also makes sure that when writing to the history file, it takes into
consideration whether or not data was generated.

2. Upon fetching the name of a file to save, the output directory is
fetched from the configuration.  This change makes sure that directory
exists by creating it if it doesn't.

Change-Id: I70f45968347b3a58bcf3a4a63993ed0229b1d15e