Move getLock into State class
Update tests for getLock's move
Use flock, not lockf, so it's testable