open file rw only if it is writable