HSA and Medicare

I turn 65 in August.  I work full time and have an HSA.  I have NOT signed up for Medicare Part A so that I can continue to contribute to my HSA.

I don't intend to sign up for Medicare until I am no longer working full time.

Once I am no longer covered with my employer's insurance plan, what is the window to sign up for Medicare?

Prior to enrolling in Medicare, when do I have to stop contributing to an HSA to avoid a penalty?