That's vague. But to you mean you had your bank account open in web browser? And then - and this is important - while you had your browser open, you suddenly got a popup that your Mac was infected with some random number of viruses?
Or, I'm guessing much more likely, while Safari is open, you're getting notifications that claim you have viruses on your Mac and to download McAfee, or some other sort of garbage software?
If it's the last one, do this:
If these notices are sliding in the from the top right of the screen, a site you visited has given itself permission to send push notifications. Everything you're seeing is nothing but a scam.
Open Safari's preferences (Settings). Click on the Websites tab and then scroll down to Notifications. Clear any entries in the right hand window. You might find something similar in the Pop-up Windows heading below that. Block any you don't recognize.
Then if you want, uncheck the box to the right, as shown below here.
I personally can't think of any reason why I would ever want any website to push notices to me.