As you have worked here for four years the end of your contract is the expiration date of your work permit, not the period of time written in your contract. Therefore,  for legal termination you must wait until the expiration date of your work visa.

The ESB is calculated on the basis of the last monthly wage (LMW), which is salary plus all other allowances. You get half of your LMW for each of the first five years of your employment. You get a proportional amount of your LMW for any incomplete year.

Beyond five years, you will get a full LMW for each year of service.

You may look for another employer after termination if your present company does not object. It may even help in transferring your iqama to your new employer if you get a job in a firm that does not compete with its business.

But it is up to the sole discretion of your company to give you an NOC, even if it does not require your service any more. At the same time you may try to negotiate with the management by letting go some of your present rights. If your company does not cooperate, you will have to leave the country, but can return after one year to work for another employer.