I've heard that the Islamic world was closed to European merchants in the Middle Ages. Is this true? If so, when did it close and when did it open again?
It's difficult to give a proper answer, because during any century of Middle Ages there could be many reasons for closing trading routes for European merchants as outsiders in various parts of Islamic world (which is huge). And it didn't need to have anything in common with religion - it could be the level of civilization (early medieval Europe), an economic matter in the particular case, or just a result of war.
But let's try to clarify few things.
First of all, Islamic world, in fact, wasn't that closed to Europeans as we think. Jews and Christians could live at Muslim lands if they paid special tax. The same with merchants from Europe. What's more, some Christians could even serve to Muslim rulers at important positions, such as revenue collectors or administrators of various types.
It's nicely described in the book "Daily Life In The Medieval Islamic World" by James E. Lindsay. You can find it's full text in the link, look for pages 120-121.
Also there's a good source for that in "Europe and the Islamic World: A History" by John Tolan, Henry Laurens and Gilles Veinstein, at pages 80-81. Unfortunately in both cases I'm not able to copy-paste it.
I believe that a bit about the overall history of the trade between Christians and Muslims during Middle Ages could help you solve the problem. I'll quote Jihoon Ko and his article "Economic Impact the Islamic World Had on Christian Europe (11th ~14th century)".
The conquest of Muslims of various regions of Europe had actually ceased the major long-distance trade of the Christian Europeans overseas for a while and the commerce of Christian Europe had been limited to the local ones. But the regions which were under Islamic rules were included in the commercial sphere of the Muslims—who were the most active adventurers and entrepreneurs at the time—saw the rise of international and complicated commercial activities. The international trades in Christian regions were late to appear. The crusade created a large influx of Eastern goods and luxuries into the Christian Europe. This created a large interest among rich Europeans for the Eastern goods, and the Christian merchants saw this to be an opportunity for a dramatic profit. As the merchants began to actively engage in the trade with the Islamic world, the trade of the Christian states overseas began to flourish. The leading states of the trade with the East were Italian city-states, most notably Genoa and Venice. The extent of the international trades before the 11th century, however, was nothing compared with those of the Muslim world. The case of Al-Andalus indicates how well established was the Andalusi merchants’ trades compared with the Europeans in the same era.
This way first, European (Christian) international trade wasn't well developed until 11th century, mainly due to the fall of ancient culture. It took European civilization a lot of time to get up after that.
But there were some smart merchants who made a fine business by initiating contacts between both worlds. They were, of course, Jews.
There were some global commercial activities going on in the Christian world, however, before the Christians began to trade over long distance, by the Jewish merchants. The Jews were also the first merchants in the Middle Ages to introduce goods from the East to the Christian Europeans. They supplied goods from the Islamic world as soon as the Carolingian era. The Jews could travel to Europe with relative ease. Some of them settled in Italy, but majority of them were those who based their commerce in the Muslim countries. The Jews from the Muslim world reached Western and Northern Europe through Spain. At first, they exclusively traded spices, pepper, manufactured goods, and other precious stuffs from Egypt, Syria, and Maghrib. They provided the goods to the churches which used the goods to make incense for religious activities, and to the selected nobility.
When European trade market became more international, the crusades started. One could imagine that it made the trade more difficult, from the most obvious reason which is "you don't go trading with your enemy if you don't want to be killed".
Somehow, in fact it helped to open both markets on each other.
The crusades, in turn, helped to change the economic activity of Christian Europe. The crusades “enabled Western Europe to monopolize the whole trade from the Bosphorus and Syria to the Straits of Gibraltar.” Even if they failed to take the holy place from the hands of Muslims, they politically weakened the powers of the Islamic states and Byzantine Empire. The Byzantine Empire’s maritime power was weakened seriously and their merchants now could not compete with the Italian rivals, which now controlled the Byzantine Empire’s export and import trades. The crusades also caused the large influx of Eastern luxuries into Christian Europe, thus stimulating the interest of people for the trade with the Islamic world. So, it is no exaggeration to say that the crusades were crucial factor in the revival of extensive economic activities of Medieval Christian Europe.
As it's described later, the main European ports that were trading with Islamic World were Genoa and Venice. And even if there were some difficulties, a business is still a business.
The trades with the Islamic world at first time were limited because of religious reason, and because of technical reasons, but gradually the Italian merchants began to seek profits and the economic incentives were large enough to overcome religious obstacles for greater incomes. As a result, the Italian city-states rose as major maritime commercial centers from 11th century, and the scope of their trades even exceeded that of the Muslim ports.
I'll quote only two paragraphs more and I'll leave the rest to you, if you're more interested in the trade with Islamic World in overall, not only from the point of it's connection to religious problematic.
Christians and Muslims have been enemies by principles. Moreover, as the Middle Age was the time when the religion affected the lives of Christians most significantly, the Muslims were considered evil by Christians. This aversion of Christians toward Muslims, however, could not stop the economic interest of the Christian merchants, and the new pattern of global trade appeared.
The Muslim world indeed acted as an important trade partner of Europe in the Late Middle Age. They facilitated the European trade and thus strengthened its economy. Also, they provided the goods that were not available in Europe, and this fact made Europe a favorite place for European merchants. The religious principle could not separate the two. The trades between Europe and the Muslim World sometimes stopped because of political situations, and were greatly reduced when the Turkish soldiers occupied Constantinople and destroyed Byzantine Empire. However, it is evident that the two had long-time economic connections, and such connectivity helped the European economy a lot.
As a terminus post quem for such closure (if it ever existed at all) one might suggest the early 9th century, as evinced by the following classic story:
In 828, relics believed to be the body of Saint Mark were stolen from Alexandria (at the time controlled by the Abbasid Caliphate) by two Venetian merchants with the help of two Greek monks and taken to Venice. A mosaic in St Mark's Basilica depicts sailors covering the relics with a layer of pork and cabbage leaves. Since Muslims are not permitted to touch pork, this was done to prevent the guards from inspecting the ship's cargo too closely.