On Borrowed Time (1939)
Grandpa is twisting an apple stem and gets a wish. Because kids are stealing apples from his tree, he wishes anyone that was already in the tree would have to stay there until he says they can leave. The apple stealing kids are suitably horrified when they are stuck in the tree and vow never to do it again. He says they can go - and they can.
Later, Death comes for Grandpa but the tricksy elder asks for an apple from the tree before he goes. Death agrees and....