I am on H1B visa for next 2.5 years
---What you are trying to say is that you have Valid H1 for 2.5 years.
but due to personal reasons I have decided to go back to my native country in next few weeks.
---when you are out of US you are not on H1 status. when you enter US on H1 then you are admitted on H1 status.
How long I can stay in USA after I give my employer a resignation letter?
------10 days.
Is my visa going to be determinate automatically?
-------when you go out and inform the employer that you are not going to work with him then he will revoke your H1 petition by writing to USCIS. Your H1 visa Stamp is based on Valid Approved H1 petition If employer revoke the Petition then Visa stamp will be of no use as you cant enter on that Visa stamp. Dont mix Visa stamp with H1 petition
If not what are the steps of the “closing” process?
---just inform your employer that you are going back to your native country on date XXXX. Who should fill in the paper work to the immigration office, me or my employer?
-------You have nothing to do. you can inform your employer.
Thank you for advice