Fix insidious finalizer bug on compound datatypes

This bug gave me headaches… The problem was that the finalizer for compound datatypes was called twice with the same id, despite the `id == 0` check in `Close()`. Very weird. I don't fully understand why. A clear explanation would be welcome!