bpy.data.libraries.write not working?
Check the data

Chances are   the objects are saved to the library blend, . but are not linked to any scene, or collection, hence the file appears empty when opened.

Check the library files bpy.data.objects collection to confirm.

Consider adding the scene datablock to the library.