Fix J Integral adjacent to free surfaces

Note that this commit doesn't actually quite work correctly because of issue #3897.