null-safe closer