Prevent resource leak