[Lockfile] Make sure file descriptor is closed.

Tip of the ‘ol hat to @floere for finding this.