Banish atoi(), and let the validation worry about too low values.
close() fails with -1.
Save the config only if changed.