Refactor TorrentState to build the class attributes
[#1032] Keep track of torrent errors over restarts

 * Add error_statusmsg to TorrentState
 * Adds a new set_error_statusmsg() method to force torrent error state.
 * Any torrent in error state will remain in that state on restart with
   additional message in status.
 * Any new libtorrent errors will override manually set ones.
Use flush_disk_cache as a shutdown marker

This is a hacky fix for waiting_on_resume_data not being empty on
shutdown. This issue needs further investigating.