I think an open stance is used mainly for cross-court shots, and a closed stance would be used for line shots, but I can also use a neutral stance for either of those. When is the optimal time(s) to use an open or closed stance?
Well, you've pretty much said it yourself - a more open stance helps you to really tee off on cross-court shots whereas a closed stance helps you keep your stroke nice and tight to snap that shot down the line.
The "optimal" time to use these stances is, of course, very subjective. However, since you say you can also hit these shots in a more neutral stance, I propose an experiment for you that will help you figure out how your stance affects your shots.
Next time you play, try opening up your stance when you're trying to hit a tight shot down the line. Conversely, try closing your stance when trying to hit a winner cross-court. Unless you're a very uncommon player, opening up your stance on a shot you're trying to hit down the line will likely result in a loss of accuracy and power. Sure, you might keep the ball in, but it won't have the same zip on it, as you'll be shortening your stroke in order to keep control (even if you don't realize it!). The same is true when you close your stance to hit cross-court. It's tougher to get the ball fully across the court when your leading shoulder is keeping you from following through with a full swing. Most likely, you'll end up hitting the ball more towards the center of the court than you'd like.
Footwork is often under-appreciated in tennis, in my opinion. Drawing a line running directly through both your feet towards the other side of the court as you take a hit is generally where the ball is headed. This can also help you to anticipate your opponents shot placement as well. This isn't the end-all, be-all, but unless you're playing at a fairly high level, I find this info generally true.
In my past experiences in tennis, closed stance is more often used when you aren't necessarily running for the ball, but it is well within your reach. You often see this used when a player first hits a good ball, and then gets an easier ball back because his opponent had more trouble doing so. The player gets more time for the ball and can use his closed stance.
The benefits of the closed stance are that you tend to get more power and control from the shot and if you can, always try to utilize it when you have a chance. It's unlikely that you will ever see a player set up well for a ball with his feet, then decide to use a open stance.
The reason for my previous point is that an open stance is more often used when you are hitting a "hard to reach" ball. It's very useful because this still allows you to still generate power while being on the run.
I have noticed that I have considerably less control in many cases when using this stance. My shots tend to be a bit more erratic and will oftentimes create great results or some very counterproductive ones. But for me, it usually is easier when trying to hit less common shots like angled shots.
Of course, both stances are used interchangeably but can either magnify or offset the outcome of the shot. I have laid out the advantages and disadvantages to you, but in the end, it's very subjective and can only really be practiced by you. Small things like this can really have an impact on your overall tennis, so choose wisely!