[datastream] rewrite (3) finalize unregister and cleanup