Closed-cell foam is waterproof and will not allow water to move through it. Water can be moved through open-cell foam. Water shouldn't be stopped by insulation. The assembly designed to keep water out are the roof, wall, and crawlspace.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.