Goodman Brown is a pretty problematic guy. He lives in a Puritan community, apparently a Puritan (Protestant Christian) himself, and yet he plays fast and loose with his faith, symbolized by his wife, Faith, in the story. Initially, he feels badly that he is causing his pretty young wife to worry and thinks that a dream, perhaps, "had warned her what work is to be done to-night." Such a thought proves that he knows he is going into the woods to do something he should not.
Further, he says that after this one last night, he'll "cling to her skirts and follow her to Heaven." However, this is not the way one's Christian faith is supposed to work. The faithful should constantly strive to follow God's laws, doing one's best at all times to act with integrity and honesty. One should not simply decide that morality is inconvenient at times and feel free to make a conscious decision to behave immorally with the avowed intention of returning to morality once the fun has been had. Brown ruins his relationship with God here, early on, when he makes a conscious decision to do something he knows to be evil. In the end, then, on his deathbed, "no hopeful verse" can be carved on his tombstone, and his "dying hour was gloom" because he lost his faith long ago. He broke ties with God when he left his Christian faith (personified by his wife) behind on that night, when he was a young man, and so he spent the rest of his life in despair. The final scene thus clarifies what I originally took to be the story's meaning: that faith is not something we keep when it is convenient but, rather, it entails the work of constantly and consistently striving to be good.