Refactor resource cleanup methods in compute.base

This commit refactors the cleanup methods in compute.base to reduce
duplications.

Change-Id: Ib322b78a3d969a2ecd1fb20c26755cf5d5e04bd0
1 file changed