Pre-opened test file needs to be opened in binary mode.