in reply to Filehandles - opening/closing a filehandle
wrt files, you don't appear to be closing your file before opening it again for write.