Up to you, to me it would be clearer to know that the person was no longer viewing the modal when the step on line 23 happens, but definitely debatable