Raise exception when data to write isn't a list