Add connection shutdown through connection manager

Targets #640 and #641.