The one time it happened to me - and as a result of my own neglicence - my instructor tapped a nice lesson out of it: he first let me struggle the door against the wind, while steering the plane and gently asking who would be doing that if I were solo. When I began to get frustrated, he calmly told me to leave off, then put the plane in a rather pronounced side-slip and presto! the door shut all of its own.
This was in an FK-9, much like a C152 in appearance.
I have since learned that side-slipping can also be tried in case of engine fire - but I hope I need never try it.