Revert "Use std::unique_ptr instead of ScopeGuard"

Revert submission 2780893

Reason for revert: breaking boot tests

Bug: 308214260

Reverted changes: /q/submissionid:2780893

Change-Id: I7a4ee9a45583a8a1d4a33447de55c63e6ce9d42a
10 files changed