US stocks hold modest gain on final day of volatile year