Allow Dot.write() to work with file-like objects as well.

Addresses #2.