fixed a few memory leaks in the reader open call.