I personally find that the wizards are hit and miss and I prefer to set things up myself where possible. I've had the wizards say "everything is great" only to discover that one step failed, but it kept going. Or it'll say it failed and roll the whole thing back when it is a simple thing to correct.
With intermittent issues like that, my thought is usually something along the lines of the network. I've seen faulty ethernet cables cause all sorts of strange issues for example. I've seen faulty patch cables pass along enough good packets for most simple test related thing to pass successfully, but as soon as a load is put on it, it fails. Not 100% sure what was wrong with the cable as it would pass the gigabit tests with our cable tester, but when trying to stream video across that cable, it would have TONS of packet loss.
Might not be the network, but since nothing changed on your end and it just suddenly worked at one point, I would be thinking it is either some intermittently faulty hardware OR someone is changing configurations on something (firewall for example) and not letting you know.
What may be interesting to do is a constant ping between all boxes participating in the AG and let that run for a few hours and then cancel it and look how much packet loss you had. If you see a lot of packet loss, I'd bring in the network team.
The main reason I don't think you are doing anything wrong is that you changed nothing, just tried it again, and it sometimes succeeds. To me this indicates the problem is NOT with the setup or configuration you have in place, but is something likely related to the network (in this case).
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.