Lock data files before reading

Fixes bug reported by Keith Bartholomew on twitter:
https://twitter.com/ktbartholomew/status/453388791743393792