make sure that resources will be closed