The exhausted dog was almost eaten alive by maggots