You don't lose your work visa when you are laid off. You can remain in Hong Kong until the end of your work visa validity and even apply for a job. Your new employer just has to apply to IMMD for change of sponsor on the visa you own (personal experience).