Added exception handling around writes. Will flush the connection and keep going.