Add catch closing resources