Fix pyc compilation

Looks like compilation to .pyc with bin/hyc doesn't work. 

On python 2.7 file is opened with io.open instead of the builtin open, but marshal.dump can't use io.BufferedWriter as second argument (TypeError: marshal.dump() 2nd arg must be file).

On python 3 there are two other bugs: 

* There is no long type in python 3;

* .pyc files in python >= 3.3 have new format with file size in header.

I wrote a small fix for these issues.