writeGcode

Writes the gcode to file(s) based on layerMode, name and folder.