Closes #190 - Fix all potential resource leaks

Pull request for #190
I was thinking close() should be able to call called multiple times.  however, i will add back in the precondition after our discussion which I commented about in #187