More null checks in detectAutoClose