Judge resentences man on appeal to longer jail term on firearm charge, days before release