Catch IOError for disconnect