check for null in closeQuietly