ENT-992: fix improper resource shutdown or release (CWE ID 404)