Change file mode from r to rb for compatibility with Windows