java: add close() method to avoid some unknown crash caused by finallize() on Ubuntu 14.04. FIXME