Fix a potential resource leak.