Every sexual act deprived of the marital meaning, or the procreative meaning, or the unitive meaning, is intrinsically evil and always gravely immoral. Masturbation is deprived of all three (even if the person committing the act is married).
Intention never justifies any intrinsically evil act.
Neither does a difficult circumstance justify an intrinsically evil act.
Climax, for the man or the woman, is not essential to the immorality of a sexual sin. So if a young unmarried couple unfortunately decide to have premarital sex, and one or the other or both do not reach climax, the act remains a gravely immoral sexual act. The same is true for other intrinsically evil sexual acts: homosexual acts, unnatural sexual acts, adultery, masturbation, etc.
The only moral sexual act is natural marital relations open to life.