Added code to close access to resources.