They say everyone come into our life to teach us something. When someone is in your life for a reason, It is usually to meet a need you have expressed. They have come to assist you to grow, to learn, to provide you with meaningful experiences that you have never experienced before. To aid you physically, emotionally, or spiritually. They are there for the reason you need them to be.
Then, at an inconvenient time, this person will say or do something to bring the relationship to an end. Sometimes they walk away. Sometimes they hurt you and force you to take a stand. Sometimes they die. What we must realize is that our need has been met, our desire fulfilled, their work is done. Your need has been answered, and now it is time to move on.