Finished code to write netlist to file