Can Roth IRA Over contribution in 2016 be corrected in early 2018 before filing date?

I contributed too much to my Roth in 2016.  I paid the 6% penalty on my 2016 tax return.  If I remove the excess contribution in January 2018 before filing my tax return will I still need to pay the penalty on my 2017 return?  Have I missed the opportunity to avoid the penalty by not removing the money in 2017?  I cannot contribute anything to IRA in 2017 or 2018 because of no earned income.  Thanks!