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.
Bare S100 CPU Replacement for ALTAIR 8800 IMSAI 8080 JAIR Single Board Computer
$42.00
MITS Altair 8800 Computer Bamboo Reproduction Arduino Tested Working Assembled
$649.99
MITS ALTAIR 8800 Original Vintage Microcomputer
$6000.00
S-100 backplane motherboard bare PCB 9 slot (for Altair/IMSAI)
$30.00
Vintage SCCS Interface Microcomputer Magazine Pair 1976 IMSAI 8080 Altair 8800
$26.00
MITS ALTAIR 8800 Original Vintage Microcomputer with 14 boards - Buy It Now
$9500.00
MITS ALTAIR 8800 Original Vintage Microcomputer S-100 Buy It Now $5999
$5999.00
Altair MITS 8800 CPU Parts Kit not IMSAI 8080 S100 (board NOT included)
$64.95
Vintage Altair 8088 CPU Wire Wrapped S100 Card w Mon EPROM circuit board #T71
$99.00
1974 Early Microcomputers by MITS Altair 8800's Ed Roberts HP-9810 Mark-8 Scelbi
$55.00