Infinite loop when multiple debuggers have been attached.

Replaces pull-request #2388.

Fixed infinite loop on exit in the event of where multiple debuggers have been attached an there is an uncaught exception.

Test code:

```python
from IPython.core.debugger import Tracer;
Tracer()
Tracer()
raise Exception
```

Pinging @DamianHeard to review.