Thankfully it was a very small terrier and it also seemed like the tail was pinched, so it was still within the door, not the part that actually goes up. It's probably sore right now, but he'll live. I just hope that cow still takes him to the vet. He at least needs a check up.