Disconnect whenever a write fails