So, this might be a 90s or 2000s movie. I watched it as a kid and it was dubbed to my native language. Basically, the kid’s family movied into a castle. There he met with a ghost who is does not mean harm. At the end of the movie this boy helped the ghost reunite with his corpse which was behind of a wall. So the ghost died as a man who was chained and walled up in that castle. I distinctly remember that the living sutuation was kind of tricky. I think there was a talk of inheritance and insurance fraud. I think the ghost was animated. And the kid carried the ghost in his arms when he put him back into his corpse.