Use ffi.gc instead of manual exit.