Fixes open file leak when a path is sent instead of an I/O stream

upload_flickr does not properly close out files leading to an open file leak.
When an I/O stream is passed we probably don't want to close the file as the sender may still want it open, but when a file path is sent we should be closing out the file