Add max-tries logic to Stop()

Fixes #276