Fixed edge case where stacking order is wrong. Only occurs when creating modals hidden, and then showing later in a different order to creation. Now new index is based on index of current open modal