release connection when applicable

Change-Id: I69486bb1280a3d1b2b44199066490b3636c54637