Flask is open = it is empty.
Flask is closed = do some magic :-).
Your best friend is Divination school:
This item uses the spell Trap the Soul, which has permament duration.
This duration is defined as:
The energy remains as long as the effect does. This means the spell is vulnerable to dispel magic.
I would say that you can use for example Detect Magic spell or Arcane Sight. There is note in Detect Magic which says:
Outsiders and elementals are not magical in themselves, but if they
are summoned, the conjuration spell registers.
With this spell you are not able to say, what creature is in.
You can also use the Identify spell. It says that:
The spell determines all magic properties of a single magic item, including how to activate those functions (if appropriate), and how many charges are left (if any).
Another spell is Analyze Dweomer it says:
In the case of a magic item, you learn its functions, how to activate its functions (if appropriate), and how many charges are left (if it uses charges).
There are also not direct spells. For example Contact Other Plane, Limited Wish or Wish.
And some not mentioned spells for Clerics: Augury, Divination, Commune and of course also Miracle.
With some of these spells you should be also able to say (with some certainty) which creature is in the flask.
Last, but not least - I don't know which magic appearance you use for your magic items. Since the flask should be covered with runes it is up to the DM if those runes says for example: This is the Iron Flask. or if it says: This is the Iron Flask currently containing Glabrezu.