You can ask your current employer to make counteroffer. Also, indicate that you are willing train the next guy before you leave. You want to leave in good-terms.
You should also know that when an employer want to terminate you, they don't think about your current situation before they lay you off. You still get laid-off when you are in middle of having a baby and need insurance. So employer's current situation shouldn't affect your decision.