It seems that ALT+F4 to close the active window / minimise to tray (rather than CTRL+Q to close / quit Joplin) is an OS shortcut not a Joplin one.

close_window

If the OS allows it you can change the shortcut key system-wide. The below screenshot is for a KDE-based Linux system.

However changing it to CTRL+W may be problematic as that may already be used for closing an open tab.