Closing then checking for EOF? Sounds buggy.

Do you even need to close manually? I thought RAII would handle that.