Fix for 533 - use of write_which

This is a fix for https://github.com/nipy/nipype/issues/533.

Please see that ticket, or write me with any questions.