The withdrawal method is an extremely unreliable method of birth control as there may be the presence of pre-ejaculate which can also contain sperm. The timing of withdrawal may also be incorrect.
A woman in her 40s will still stand a chance of pregnancy as long as she has not undergone menopause yet (though chances are lower compared to women in their 20s or 30s).
I encourage you to consider proper, safe and effective birth control methods to prevent an unwanted pregnancy if you are considering birth control methods.
You may refer to this article here for more information: https://www.human.com.sg/guide-birth-control-singapore-costs-and-options.