BF: fix writing history to file in Python 3

Need to open file in binary mode to save text, strangely.

See:
http://nipy.bic.berkeley.edu/builders/dipy-py3.3/builds/227/steps/shell_8/logs/stdio
for error.