allow the user to specify file mode.

This is useful if you start writing a file, and wish to do something like append to it later.