Prevent concurrent script execution or corrupted database due to interruption