Abstraction and Implementation of a Lightweight Distributed Termination Protocol