searching on google for this topic found that PIL magically close files when it doesn't need them.