dlfcn: fix corruption caused by dlclose()

dlopen() will return elf::program when filename is "" or NULL. However
dlclose() always assumed std::shared_ptr<elf::object>*, which resulted
in memory corruption.

I've noticed it because after my unrelated httpserver changes
tst-dlfcn started to hang during 'make check' when trying to lock some
mutex which got corrupted.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>