Try not to leave directories behind with incorrect permissions
Use more fnmatch-like matcher in .stignore (fixes #426)
Fix fnmatch tests for Windows