Add ability to close a connection and remove it from cache, add test coverage