As cjl said, some of the energy will be converted into heat inside the string itself. For steel strings this would happen very slowly, but it would be faster for nylon strings. No material is perfectly elastic, and if you measured the force and displacement very accurately, you would see that the graph when the force decreases does not lie exactly on top of the graph when the force increases. In fact, the (small) area between the two curves is a measure of the amount of mechanical energy that is "lost" and converted to heat.
Another (and probably quicker) way that the energy would be turned into heat is by friction. The vibrating strings move slightly backwards and forwards over the bridge and the top of the fingerboard with each cycle of vibration, The joints between the different parts of the guitar body will also move slightly relative to each other, etc, and everywhere this happens there will be a friction force that does work and generates heat.
All those effects are also happening when the guitar is not in a vacuum, of course. You may have assumed that all the energy in the string was converted into sound energy but I bet you never did an experiment to measure whether that was a good assumption. (It would be quite a difficult experiment to measure this accurately, though)