attempt to fix bug reported by Dave Mellis:
"avrdude: ser_close(): can’t reset attributes for device: Invalid argument"
is thrown after attempting an upload in the IDE (though the upload seems to be successful)
Earlier approach had bootloader end as soon as it was told to. On Linux this caused problems with avrdude because the microcontroller never had a chance to send an acknowledgement.