Without the source image, I'm just going to use a contrived source.
% a grayscale image
inpict = imread('opencontour.png');
imshow(inpict)
% binarize it somehow
bw = imbinarize(inpict);
% use bwskel() instead to get rid of extraneous branches
% this may end up truncating the contour if you're not careful
skel = bwskel(bw,'minbranchlength',30);
% find all the endpoints
skelEP = bwmorph(skel,'endpoints');
% there should probably be some effort here
% to make sure that there are only two relevant
% endpoints left
% ....
% draw lines between the endpoints
% this only makes sense if there are only two endpoints
% bridge = bwconvhull(skelEP);
% alternatively, this just draws a polyline between the points
% it still only makes sense if there are only two endpoints
V = vertcat(regionprops(skelEP,'centroid').Centroid);
bridge = brline_forum(size(skelEP),V);
% combine the two
outpict = skel | bridge;
imshow(outpict)
There's probably a way to use watershed here, but I'm not sure if that's any more convenient/reliable.