what happens if you quit right after maternity leave

If you wish to resign during pregnancy, you will, as usual, be required to submit a resignation with the notice period set by your employer. At the end of the notification period, your employment relationship will end and you will be entitled to regular wages and benefits during the notification period. 

 You are entitled to maternity benefits even if you quit your job  after  the 15th week before your baby is born (which corresponds to about the 26th week  of  pregnancy) and  meet your eligibility requirements. However, if your employment relationship ends 15 weeks before your baby is born, you will not be eligible for the statutory maternity allowance, but you may be eligible for a maternity allowance (even if you are no longer hired). Your right to maternity benefits is described below.

Resigning from your job during or after maternity leave

I  decided not to go back to work. What do I have to do and what am I entitled to? 
 You must resign in the usual manner, respecting the notice period stated in your contract or agreed with your employer. If you quit your job during  maternity leave and you do not have to return to work within the notice period, you are still entitled to maternity leave. But if you resign after  your maternity leave ends, you must work on advance notice unless you have agreed to take annual leave or  need  sick leave. 
 Maternity benefits last 39 weeks but maternity leave lasts  52 weeks (the last 13 weeks are usually unpaid). You have the right to  maternity leave for up to 52 weeks and to quit at the end of your maternity leave  if you decide  you cannot return to work. 
 You continue to accrue all of your contractual benefits, except your regular salary/wages, during your maternity leave, so that you continue to receive your contractual benefits until the end date. employment contract, ie at the end of your notice period. Your annual leave continues to accrue until the end of your contract, including  maternity leave, so you are  paid for any unpaid annual leave.