Add max-tries logic to Stop()
Merge pull request #279 from tianon/stop-timeout

Add max-tries logic to Stop()