Hey Khaled, thanks for the fix!
Two more things for you, dunno how you feel about them:
a) It's still removing empty lines between comments and key/value pairs. Windows' INI routines preserve those.
b) A file saved as ANSI/Windows-1252 will be converted to UTF-8 any time writeini is issued, even if it's on a different section and/or key. Is that intended?