Added file persistence to memoize decorator

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.