unload resource when finished