[aws_cpi] Fix bug when deregistering an image