Open files at read/write time only

In the previous version, all the files in the torrent were opened until the application left. This doesn't work with huge torrent files (tested with a 1326 files torrent), so this commit opens files at reading/writing time only and closes them directly.

Obviously this has impacts on performance (which must be the reason why you chose to open all files first), but it's the simplest way to make it work. A possible improvement could be to keep some files open in an LRU cache, and/or to pre-open the file after the one we're currently reading (assuming the other peer picks blocks sequentially)