Turn off autoclose for connections and always read before closing.