Added file persistence to memoize decorator

(apologies for duplicate pull requests -- wanted to make a specialized branch)

The memoize decorator that's used to cache segments doesn't work with tmux since the caching mechanism stores results in memory, which is erased after the script has been evaluated.

My solution adds a "filename" argument to the memoize decorator, which should contain an absolute path to a file that will hold the pickled cache. Might want to change this to always put the file in the tmpdir.