Retake status file lock if an error caused it to be lost (for WebJobs).

Fixes #1340