Fix opening serial port

Running ser.open was unnecessary and caused breakage on my system.
Use avrdude (more reliable than arduino IDE)

Also tidy up.