Fixing file open modes

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>