First of all, Thank you for serving. We all do appreciate your time and effort in doing this. You mentioned about your PTSD, so it sounds like as has been said, that you have some knowledge on the inner workings of how it operates. However, it does affect each person differently. Tho, from my experience, that one thing most PTSD people have in common with their treatment is setting a routine.
When you find that the routine gets broken, then we panic or the " oh, sh** " . If you are not already in treatment for your PTSD, please look up your closest VA for assistance. Your first step is admitting to yourself that their are issues.
As for leaving your weapon, I think now that you have had that scare, you will be more aware and add it to your routine to check and double check every time you take it off away from home. It's all a learning experience and it some cases a relearning experience or changing routines.
If you are like me, I do not like changes any more as it is hard to make the new adjustments, even minor ones. But keep at it. You will prevail. Good luck to you. :)