Make sure cache file gets closed if refreshing item fails

This avoids a ResourceWarning in Python 3 when the cache item needs to be
refreshed, and there is a DNS address lookup error, causing SharedItem() to
raise an exception.
Fixup “regex” → “re” conversion
Fix imports to work with Pillow fork of PIL

* “pil_interface” module could be resurrected from PIL 0.3a4
Merge branch 'master' into HEAD

Conflicts:
	src/AsyncImage.py
	src/CacheMgr.py
Use raw string literals and “verbose” regular expressions
Use field names of named tuple results

* stat(), struct_time(), urlparse()
* stat.st_mtime is a float() instead of an int()