If you really wanted to imprison him forever, then you would probably have to do something like cast, I dunno... imprisonment? From within the demiplane, so that it isn't trivially dispellable. And then you put some common item that has some distinguishing features in the room. And then sequester it. And modify memory yourself so you don't remember what the distinguishing mark is. And you probably have a simulacrum cast the demiplane so you can destroy him afterwards and then no caster remains who can go straight to it. And you'd have to do it all within a private sanctum so no one watched you while you did it. And even THEN, someone could probably still find the place by asking a sufficiently interested deity. And someone might be able to true resurrect the simulacrum, because techincally they're a creature... but can they be resurrected if you've created another simulacrum since then?
Seems like it might be better just to let a barghest eat them and then hang on to the barghest for 24 hours.