go fmt
Add locking of the state file.

This prevents two client/editstate processes from trying to use the same state
file at the same time.