close resource.