Restore graceful recovery on connection reset (deinitialize before retry, which clears the file descriptor allowing the OS to reallocate the same device node)
Abstract flushing routines to more easily check valid contexts. This along with additional code prevents a segmentation fault if ^C is passed before serial connection has been made (ie during the connect loop)