there needs to be a space after the comma.

Also, the /etc/network/interfaces file is not a binary file.  I think if the mode is just 'r+', that should work.