Properly close pointer if kstat_lookup fails.