It's a dark looking animated movie possibly quite old. It ends with cloaked figures walking in a line with lanterns in a dark scene as the camera pans forward. I think there is a skeletal like character in the movie.
With the details you've given The Nightmare before Christmas seems to be the most obvious answer to me. The skeletal figure and the dark looking details fit. So do the lanterns but I can't remember the ending so I'm not sure about that particular detail.