-Added some error checking to torrent file writing