Update to close resource after use