Update scripts.js

Added a condition for auto-closing mobile menus