[DataPipe] adding a finally statement to ensure hook is reset (#70214)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70214
cc VitalyFedyunin ejguan NivekT
Test Plan: Imported from OSS
Reviewed By: ejguan
Differential Revision: D33255306
Pulled By: NivekT
fbshipit-source-id: de2fe6bf08328e481c714aaad390db771073469e