I'd solve this use case in bash using flock, if you are in a linux like
environment (on windows, use cygwin).
https://linux.die.net/man/1/flock
e.g.
flock -x video.mp4 -c poweroff
The exclusive lock is acquired when no one else has opened the file with
read or write access. That might mean your video editing software closed
the file. Or not. For you to check.