Irrespective of it is written in your Contract or not, the company has to pay the gratuity to you before cancelling your RP.

Article 54 of Qatar Labor Law:

"In addition to any sums to which the worker is entitled to upon the expiry of his service, the employer shall pay the end of service gratuity to the worker who has
completed employment of one year or more. This gratuity shall be agreed upon by the two parties, provided that it is not less than a three-week wage for every year of
employment. The worker shall be entitled to gratuity for the fractions of the year in proportion to the duration of employment.
The last basic wage shall be the base for the calculation of the gratuity."

You employer shall bear the repatriation cost too.

Article 57 of Qatar Labor Law:

"Upon termination of the service of the worker the employer shall at his cost return him to the place from where he has recruited him at the commencement of the engagement or to any place agreed upon between the parties."