Write until we write all of the data