Fix resource leak #12