This lets user fns do some deferred cleanup before a harness is shut down. Imported from Jira [BEAM-3704](https://issues.apache.org/jira/browse/BEAM-3704). Original Jira may contain additional context. Reported by: tgroh.