Window closes automatically when picture is uploaded