Section 24. The board or officer having authority over public ways in a town shall, if the public safety so requires, cause such ways to be closed where they enter upon and unite with an existing public way or may by other sufficient means caution the public against entering thereon; otherwise the town shall be liable for damages arising from defects therein as in the case of ways duly laid out and established.