Shakespeare probably wrote this play between 1604 and 1605. Interesting how Shakespeare popularized this idiom as an oft-used expression with the play's title: "All's well that ends well." According to Freedictionary.com, it means:
Everything has turned out satisfactorily, even though the outcome has been uncertain. For example, His lawyer persuaded Jack to plead guilty, but the court merely put him on probation-all's well that ends well. This proverb, dating from about 1250, gained even more currency as the title of a Shakespeare comedy.