Actually, in earlier centuries (I don't remember when), sometimes they had a string INTO the coffin hooked up to an outside bell.
It was because they were worried that the person might be in a coma with shallow breathing and not actually dead. So if the person woke up s/he could ring the bell to let people know. Supposedly there WERE a few times when that did occur.
Plus, even though something might not actually occur, a person might still be afraid of it anyway.