Issue #2249203 by jhodgdon: Fix problem with orphaned file records