Added memory dump function.

-- Untested.
Added an option to dump the memory to a file.

-- The file is written upon program termination.
Added logging for dumping memory files.
Added a log message for reading from a memory file.
Fixed error-checking order for reading memory file.