Nearly working: write to file

Almost able to write a torrent download to a file.