You have virtually everything you need to answer this question. Let me point out what you have done. In your proposed mechanism, structures 2 and 3 are in equilibrium. The ring can form and break. If you replace the carboxylic acid OH with a hydrogen, you could write the same mechanism. You might even find it useful to replace the ring in 1 with a CH2OH group, and draw two mechanisms with these modified structures. You will need to complete formation of a double bond by the loss of water.
If you do that, you might recognize that a CH2OH group is attached to a five carbon chain between a carboxylic acid and an aldehyde. Then you may recognize that the CH2OH group can cyclize onto either carbonyl group with a mechanism as you have proposed.