Make sure all resources are closed.