Ensure components are properly destroyed before clearing.