return a deferred from ampclient that fires when it's finished

This doesn't apply to the latest code from your pastebins, but the idea here is that the client should not call `reactor.stop` itself.  it should just return a Deferred which fires when the client has done everything it set out to do.  Then whatever invoked the client - `run.py` or `ampclient.py` - calls `reactor.stop()` when necessary (and handles any failures).  Hopefully you can adapt this to the code you're currently working on.