Close the tempfile for shell prior to yielding the path [GH-1040]