Interactions of planetesimals with protoplanetary atmospheres