fix nash.py to use the new write() interface

If this fix is okay, could you push to agg branch as well?