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