I'm very sorry to hear you have lost your job. Once contracts have been signed by both parties they are binding. If you are unable to close ( i.e finish the purchase ), you will have to forfeit your deposit.
I think the best advice for you at the moment is to make an appointment to see your solicitor urgently. Only they can advise you properly in your particular case.
Perhaps you have gotten redundancy or somehing that will tide you over ? All may not be lost, good advice & assistance could see you through.
Best of luck