See the following links
How to Close the Browser Which Started a Forms Session (Doc ID 865745.1)
How to Close the Browser Window When Closing Forms Note:201481.1
For Ctrl + Q, you need to see the following link (ID 1367967.1) for key mapping. When user action with this keys, it will automatically call browser closing logic as mention in step 1. No further action required.
Add entry like this in fmrweb.res file, see detail in below link
81 : 2 : "Ctrl+Q" : 32 : "Exit"
Customizing Keymapping and Resource Files for Forms on the Web -fmrweb.res, fmrpcweb.res [ID 1367967.1]
For F4, it is default closing key, When user action with keys, it will automatically call browser closing logic as mention in step 1. No further action required.
I hope, it will help you.
You can find the location of existing virtual path at:
The above virtually maps to the following by default:
Complete path would be like this: http://<server>:port/forms/html/closing.html
Regarding Setting new virtual path setting, for this you need to define virtual path in INSTANCE_HOME\config\OHS\ohs1\moduleconf\forms.conf and need to restart OHS service.
For information on creating a virtual path for the HTTP Server, please refer to the HTTP Server Administrator's Guide
I think, you better go with existing virtual path as mention above; once thing working fine then try to define new path and play with it.