Correction: Mozart wrote 41 symphonies (not 40). Symphony No. 40 in G minor, K. 550 was completed on July 25, 1788. A second version adding clarinets followed shortly after.
Symphony No. 40 is one of Mozart's final three symphonies, all written in the summer of 1788:
This astonishing burst of creativity produced three masterpieces in six weeks, among the greatest symphonies ever written.