Added code to remove a file buffer when its empty