Fix the unclosed or unreleased resource problem