Now writes new graphs to file immediately instead of passing a list. May solve memory issues.