Added support for newlines when using the 'write' command.

Should fix issue #149.