A few ways!
1) You’ve finished telling the story for now with this generation, and maybe play an epilogue game about what these heroes did next (maybe a hacked Stewpot?)
2) The castle blights the world enough times and casts it all into the void (BAD END).
3) The players lock down the castle over generations, gradually robbing it of its power to shift and change until it becomes nothing more than a weird building.