I almost had a heart attack, not finding the money where it was supposed to be.
Does the above sentence mean - I almost had a heart attack (out of shock) because I couldn't find the money where I had kept it? Is it grammatically correct? What difference does how there is a comma where it is make?