Currently the only way to close a guestfs handle in perl is to remove all references to it. There are circumstances where it is important to know that the guest handle is closed before proceeding, for example before attempting to unmount a volume which is being used by guestfs. In this case, a simple $g = undef will not suffice if a code change elsewhere has kept a reference to the handle.
Usage of libguestfs in this case would be made significantly more robust by exposing the close() call, allowing the handle to be explicitly closed regardless of remaining references. Attempting to use a reference after close() would result in an error.
That was an unwelcome tour around the guts of Perl ...
Patch posted upstream: