I believe that using a swap *file* for hibernation requires special
steps, as described here:
https://www.kernel.org/doc/html/latest/power/swsusp-and-swap-files.html
I believe you need to add the kernel parameters to make it work, or
you have to switch to the userland suspend interface.