Shortest answer = we don’t know for sure!
 

What the Church Teaches on Dating Books of the Bible

The Church doesn’t offer formal doctrines on specific date ranges for books of the Bible. Which means, the Church’s understanding is that the Holy Spirit and God in his wisdom has not made this specifically known to us. 
 
This means that different people can have different personal opinions on say, if Matthew’s Gospel or Mark’s Gospel was written earlier, or if the Second Letter of Peter was written in the late 1st century or early 2nd century. It’s okay for someone have a personal hypothesis that is not the majority opinion. And, sometimes what the majority of people consider the “most likely” hypothesis on the date of a book of the Bible actually changes over time as different evidence is weighed. 
 

How the Church Discerns What Books are Inspired

 
More than a few places on the internet will say that a period of “formal” Divine Revelation ended with the death of John the Apostle. But, the Catechism of the Catholic Church (para. 105) provides a more accurate teaching, explaining:
“Holy Mother Church, relying on the faith of the apostolic age, accepts as sacred and canonical the books of the Old and the New Testaments, whole and entire, with all their parts, on the grounds that, written under the inspiration of the Holy Spirit, they have God as their author, and have been handed on as such to the Church herself.”
The apostolic age and the lifespan of the Twelve (including John) are not exactly the same thing,  though there is a lot of overlap of these years for sure! The early Church guided by the Holy Spirit discerned what we call the “canonicity” of a book or letter (meaning, the suitability of the writing to be included in the canon, or list, of Scripture, because the words were inspired by God). One of the most important factors the early Church valued was the connection to an apostle and/or the Twelve. One form of “connection” is being one of the Twelve (like John) or a named apostle (like Paul). However, other forms of connection include being a part of an apostle’s “on-going ministry team.” (Mark and Luke are good examples of authors who are not one of the Twelve, but have apostolic connections). 
 
Together, these Church teachings show that it is possible that a book or books of the New Testament could have been written after John’s death, since John’s physical death doesn’t change the “connection to an apostle”-ness of a book. 
 
I found his reflections on how the Church Fathers approached this insightful…
 
To my knowledge, the early Fathers were not focused on the date when the last Apostle died. After all, Mark and Luke do not even bear the names of Apostles, which is a clue that “Apostolic” is a wider term than we may take it for (not to mention the strange case of Paul). But this also indicates that the Fathers were fairly rigorous about the books to be included in the canon, not just slapping an apostolic name on something to legitimize it, nor mindlessly adopting something like Barnabas because it did have an apostolic title. They believed Peter was behind 2 Peter, and they were a lot closer to the events than we are.
Hopefully that helps and happy to hear any follow up thoughts. Especially if you have a Church teaching citation on the death of John as being a cut off point…I searched the CCC and Dei Verbum, and not there, so that makes me fairly confident it’s not Church teaching (since something of that importance should be in the CCC or a Dogmatic Constitution on Divine Revelation) but I am always interested “where stuff comes from” 🙂 

What Really Matters (Hint: It's Not the Date)

Biblical School Instructor, Doug Taylor-Weiss shares this reflection:
 
To my knowledge, the early Fathers were not focused on the date when the last Apostle [John] died. After all, Mark and Luke do not even bear the names of Apostles, which is a clue that “Apostolic” is a wider term than we may take it for (not to mention the  case of Paul). But this also indicates that the Fathers were fairly rigorous about the books to be included in the canon, not just slapping an apostolic name on something to legitimize it, nor mindlessly adopting something like Barnabas because it did have an apostolic title. They believed Peter was behind 2 Peter, and they were a lot closer to the events than we are.
The good news is that just as the early Church did, we too can trust that through the Holy Spirit, God has provided the exact right Scriptures that we need for nourishment as we follow Christ Jesus as his disciples in our world today. Vastly more important than the hypothetical date of any book of the Bible is the great gift God has given us in the inspired words of Sacred Scripture.