Do not worry that all the right effort spent in this life will be wasted if we fail to attain liberation before death. The Law of cause and Effect is ever true. As long as we have not attained liberation, our future lives will inherit our kamma of today. The right effort we spend today will uplift our life and thus plant the seed for liberation in future.
One who truly knows how to love oneself will abstain from causes of suffering and cultivate good causes.
Since we know all arising and perishing compounded phenomena have their cause and effect relationship, we should place effort on what good causes that we can cultivate. We can thus change our future by the present cause factor that we are cultivating.