Add Comment about locking
Add some missing file handle check