Is it possible to lock the bootloader without losing data?
On Nexus 6P the bootloader relocking method is contains the Factory Reset, there is nothing to do.

If you are trying to relock your device you should see a screen like this: image.

If you want to keep your files and data you should make a backup and when your device bootloader agian locked you restore it.

This is a normal behaviour but for example on OP2 there is a method to keep your data in save during the bootload relocking procedure.