Gracefully shut down the running threads and reactor.

Add stop() method.
Wait for the running defers to finish and cancel them after a timeout.