Fixed race condition when stopping connections
Merge pull request #623 from dswd/fix

Fixed race condition when stopping connections