Explicitly close agent connection in top level agent class.

Fixes #459
Changelog re #459