Added some I/O exception checks. Stop execution if config could not be written. Added some progress output.