Optimised to open and close file once, rather than each write.

This pays dividends when used with tools writing lots of log messages. One file open/close per class instance rather than open/write/close per $log->write($msg).