Is flock automatically released on process exit?
From man 1 flock
:
-u, --unlock
Drop a lock. This is usually not required, since a lock is automatically dropped when the file is closed. However, it may be required in special cases, for example if the enclosed com‐ mand group may have forked a background process which should not be holding the lock.