Was Safari open at the time? If so, quit Safari first and see if that sorts things out.
"Closing" an app (red dot in corner) is not the same as "quitting" an app. If you're "closing" Safari, then all you're doing is closing a window -- the app itself is still active (as should be obvious by the indicator in the dock).
Is that what's happening?