Send an unregister message when the slave is shutting itself down.

Review: https://reviews.apache.org/r/22367