diff --git a/gdata/services/picasaweb/gdata-picasaweb-service.c b/gdata/services/picasaweb/gdata-picasaweb-service.c
index 7b29311..483e591 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-service.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-service.c
@@ -384,6 +384,7 @@ gdata_picasaweb_service_upload_file (GDataPicasaWebService *self, GDataPicasaWeb
 	g_object_unref (input_stream);
 	if (error != NULL && *error != NULL) {
 		/* Error! */
+		g_output_stream_close (output_stream, cancellable, NULL);
 		g_object_unref (output_stream);
 		return NULL;
 	}
