SI-7018 Fix memory leak in Attachments.

Makes NonEmptyAttachments a top level class so that
it doesn't accidentally accumulate history via the
$outer field.

No test is included because I think the fix is
self evident.

Review by @dragos