facepalm: fix bug in thrift.to_file

Test Plan: thrift_test

Reviewed By: jhj@fb.com

FB internal diff: D1464765