What you've posted so far looks fine. What do writedate and release_lock look like?
One good way to do this is to create the new count in a different file, then rename it in to the actual name. You probably have a moment when the file is empty, and if the program crashes just then it will stay empty. By using rename instead, the file is never empty; it is either the old value, or the new value.
Another way is to open the file read-write, read the value, then rewind and write the new value. As long as the number is reasonably short (less than 1000 digits or so) and buffered writes are turned off (or you use syswrite), this should be atomic as well.
Why do you do these two lines?
open(MFILE, ">>$completeadd") || die "file open1 failed: $!\n";