Clean up the state management code in StreamReader.