The warden of the penitentiary shall have power to discharge any prisoner working on the state road force wherever he may be in the state when the term of such prisoner has expired, and section twenty-seven, article five, chapter twenty-eight shall apply to all convicts from the penitentiary on said state road force.