Create Cache directory if it doesn't exist before writing to

Otherwise a DirectoryNotFoundException is thrown.