Bugfix: Check that the stratum_share struct for a failed submission is still in the submission hashtable before trying to delete it

If the stratum share resubmission code pulls it out first, it could be gone and freed already
Merge commit '707c9f6' into bfgminer
Check stratum socket exists and is writable before even considering whether the sessionid is the same or not
Bugfix: When disabling device, ensure its prev_work (if any) gets freed properly
Merge commit '7341aba' into bfgminer