No person may be tried or punished for any offense provided for in sections 40.237 to 40.415, unless it was committed while the person was in a duty status.