Make teardown better

- Add timeout to teardown_build command execution when teardown is
triggered by signal.
- Refactor the `ClusterSlave._async_teardown_build` method into a few
separate methods.
- Give names to the async setup and async teardown threads so that we
can distinguish them more easily in the logs.
- Don't register callback to disconnect from master until we've actually
connected to the master. (This was causing an exception before.)
- Make sure to exit with a non-zero exit code if an exception is raised
during execution of teardown handlers.
It was actually a bug to add this callback in the constructor. If the slave was killed before successfully connecting to the master it would still try to disconnect. I moved adding this teardown callback logic to the end of `connect_to_master()`.