A tentative agreement between Costco and the Teamsters came just hours before workers were set to walk off the job.