Oil down, but ends year with biggest gain since 2009