Fix condition for closed contours

This should address the latest issue raised in dcjones/Gadfly.jl#420. The original code assumes that if a contour line returns to its starting cell, it is a closed contour.  That only holds if the cell has a single contour crossing.  This fix adds the condition that a closed contour must end on the same edge.

@dlfivefifty do you mind taking a look? Your data sets have been great at revealing our bugs. Maybe it can catch a few more before we merge and close this.