check body before defer close