Add support for opening a file in read-write mode