The approach is simple and granular. However I would agree with
ikegami that system cache may work against you. In *nx systems you might consider to call
sync after each file close call to have the system clean out its disk cache.
For the really paranoid among us other things that may influence success are i.e. disk controller internal caches, cache issues with remote filesystems mounted over network, parallel read/writes on the file by another process. Besides those caching aspects you need to consider filesystem type, as your data may still live in the journal logs.
Bottomline: Solid erasure of data on a granular level like files is always tricky.