Multiple cookie modal scripts don't work together

Afternoon folks! I am trying to set up scripts to set cookies when users close the Newsbar and Cookie Modal on my website. When I use the script for both modals, it doesn’t work properly (only one or the other closes).

Does anyone have insight as to why this is happening?