You can use 'lsof' to do it and probably that's the same scheme which is used by Puppy.
But you have to know that it is still not 100% safe. Because a file system allows concurrent access, at one moment your check says the file is not opened, but as soon as you start the copying and deleting the copy on the ramdisk, another process starts opening it for modification or deletion. You can imagine it will result in various confusion to your file system.
Grandstream GS-HT802 2 Port Analog Telephone Adapter VoIP Phone & Device, Black
$32.00
Polycom VVX 411 IP VOIP POE Gigabit Telephone [L/N] BUSINESS OFFICE RECEPTION
$24.00
Grandstream GXP1620 Small to Medium Business HD IP Phone VoIP Phone and Device
$21.68
Cisco CP-7965G IP VOIP POE Gigabit Telephone [L/N] BUSINESS OFFICE RECEPTION
$19.99
Cisco CP-7945G VOIP Phone With Stand & Handset Business IP Phone 7945
$3.00
Polycom VVX 501 VoIP IP Phone & Stand Blem Warranty VVX501 2201-48500-001
$14.98
Cisco CP-8845-K9 5 Line IP Video Phone - Charcoal
$25.00
Obihai OBI202 2-Port VoIP Phone Adapter -
$44.99
Cisco CP-7965G 7900 Series VOIP IP Phone ZOOM MEETING SIP SKYPE RECEIPTION IVR
$20.00
Polycom VVX 250 Business IP Phone with 2.8 in. Color Display & Ethernet, Black
$32.89