shutdown is a symlink to systemctl on xenial, and on "shutdown -r now"
network gets shut down before ssh has a chance to close gracefully.
There have been multiple complaints about this and some distantly
related fixes have made it into recent systemds [1].
This doesn't seem to happen on centos, probably because of different
systemd versions or sshd configuration, so this band-aid is for ubuntu
only. "systemctl --no-block reboot" is nicer, but not available on
trusty.