Minor fix for swig bindings.
Fix Java destruction order issue; thanks to Zheng Manchun for reporting this bug.