Explicitly free locks after file operations

Since php 5.3.2 locks are no longer freed on fclose