bpy.data.libraries.write not working? I want to save selected objects into a separate .blend file in 2.8.

https://docs.blender.org/api/blender2.8/bpy.types.BlendDataLibraries.html
suggests:

import bpy

filepath = "//new_library.blend"
data_blocks = set(bpy.context.selected_objects)
bpy.data.libraries.write(filepath, data_blocks)


I created a blank scene, added two spheres to it and saved everything.
Afterwards I selected them both and let the script run through: A ".blend" file gets created, however it doesn't contain anything.

I re downloaded 2.79 and got the same result. So I am unsure where the problem lies and don't want to file a bug report immediately without having some outside input. Could somebody please clarify things for me, please?
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.