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.
Merge branch 'make_teardown_better'

Conflicts:
	test/unit/project_type/test_project_type.py