create a proper error when we are unable to write the graph file