For some reason I couldn’t get that to work in the functions file. May be conflict or issue with the theme, unsure. I just put it in the footer. I also noticed if you clicked on something like a heading, div, or other tag inside the #message div it would close, unsure why.
Here’s what I ended up using, unsure if this is efficient code but it worked for this situation. Also added support of touch. Maybe this will help another in the future.
<script type='text/javascript'>
jQuery( "body" ).on( "click touchstart", function(e) {
var target = jQuery(e.target);
if( target.closest('#message').length === 0 )
jQuery( "#closebox" ).trigger( "click" );
});
</script>
Thanks for pointing me in the right direction.