py3 compat: Open file as binary when serializing
fix py3-incompat in test code.
Merge pull request #249 from uholzer/bug-serialize

Serializing to a file fails in Python 3 --- good catch! Thank you.
Merge remote-tracking branch 'origin/master'
Add test for issue 250. Add fix.