They both carry the same denotation; meaning that, no matter which choice you make, you are indicating something something that occurred in the eighteenth century or prior.
However, they carry different connotations. "Europe hardly had any museums before the 19th century" carries an implication that European societies had not really built many museums. Then, the nineteenth century started and, for whatever reason, the building of museums took off. It implies that the start of the nineteenth century was the start of the "museum building boom."
The latter sentence, "Europe hardly had any museums before the close the eighteenth century," implies some sort of finality or the end of a countdown. If I were studying European life at the end of the eighteenth century, I would use this phrase. It is, in essence, saying "Europe had very few museums prior to the time period I am studying. Any period after the period I am discussing is beyond my purview and not what we are going to focus on today."
The former would be more useful if you are focusing on the nineteenth century or are focused on numerous time periods. The latter would be more useful if you were focused on the eighteenth century, in particular.