Send an event on ClientClosed, and factor out some cut-and-paste

Conflicts:
	ui/app/snap/SbtProtocol.scala
Merge pull request #750 from typesafehub/wip/havocp-client-closed

Send an event on ClientClosed, and factor out some cut-and-paste