If the boot lock is visibly operational - and latching as you state - then there are only two possible causes for the warning message stating the boot is open.
I would advise checking the wiring which you see between the boot lid and the vehicle body.
This will be encased in a rubber sheath.
This can be pulled out of either end of the boot lid or body - then check to see if you can gently tug each wire through.
You should not be able to pull any through - but one may begin to slide through and then you may see the broken snapped end.
This can be repaired by rejoining using solder or electrical repair connectors.
I hope this helps you resolve your concern.