Refactoring to support connection close by the VLV code.