Improve compile error handling
Improve compile error handling

There was an issue with the flock call not failing properly
and now when fopen throws an exception (ie permission denied error)
we always fail the compile.

jacobalberty/Pearly,jacobalberty/Pearly