Fix spelling mistake in snapshot.go comment
Save config file atomically
Ensure data is on the disk for close and flushCommitIndex
Correct replacing of log file

Do not leak resources in case of errors and ensure data is synced to
disk before replacing files.