A Distributed Algorithm for Distributed Termination