Open cache with same mode for both pickling and unpickling.

I'm amazed the previous code worked with python 2...

Also, make sure the cache file is closed afterwards for cleanness.
Only mark a job as not found after trying all queue systems.

Previously if a job was running (say) locally and (say) qstat was also
available, then because qstat was checked after ps, the job was marked
as not found and hence assumed to be finished (even though it was still
running).  A job is now (correctly) regarded as found and hence of
a known status no matter which queueing system it was found in.