Insufficient information about your premises. Do chains ever cross? Do they ever fork?
If they never cross and never fork, then in the simpler case, imdilate() to get a continuous line, threshold, bwboundary with no holes. That will get you the outer chain contour.
I indicate this as the "simpler case" in that this approach does not, without modification, consider the possibility of the chain ending. Having the chain end "in the middle of the picture" is something that is possibly tractable. If, though, a chain might end exactly where it touches another chain, then determining which chain is which might be difficult.
Can there ever be three chains in the image? Three chains that all happen to end at the same area? Is the threading definitely not captured in the images?