A search for 'piano tuning software' or similar items will yield a large number of hits – some good, some not so good.
Every type of musical instrument has unique acoustic/physical/environmental characteristics that affect its sound. And it can get complicated, as thousands of books and research papers would suggest (eg: tonality, attack/decay characteristics, inharmonicity, etc.).
Pitch detection is itself a wide-ranging field. The following is but a tiny fraction of what's available: overview article 1 and stack exchange poststack exchange post and overview article 2
As for your specific questions: 1) your sample size seems like overkill – depending on SNR and waveform stability, you can get high frequency accuracy using other methods using fewer cycles. (some methods are FFT-based). And you may be capturing attack/decay with a long sample time, 2) any window other than rectangular will broaden the beam-width in the frequency domain, but that doesn't mean you shouldn't use one – Hann seems common with HPS, from what I've seen, 3) as noted in the first link above, HPS doesn't work very well at low frequency, and inharmonicity will affect you on the lower strings. As for your overall method, without having to write a lot of pages, I can only say that I would do it differently, depending on the frequency range and harmonics I was dealing with.