Pattern [거의/하마터면] ... V(으)ㄹ 뻔하다: To Come Close To

Meaning: to come close to, to be on the verge of doing V (but did not do it eventually).

날씨가 안좋아서 소풍을 못 갈 뻔했다. Since the weather was not good, I almost did not go (=but went anyway).
공부를 열심히 안해서 시험에 떨어질 뻔했다. Since I did not study a lot, I almost failed the test (=but passed anyway).
투자를 많이 했지만 돈을 거의 잃을 뻔했다. Although I invested a lot, I almost lost all my money.
지갑을 안가져와서 결제 못 할 뻔했다. Since I did not take my wallet, I almost could not pay (= but paid anyway)