Yeah gravity helps with locking bar but you might be able add a simple tension spring or decent magnet on a tab help keep lock bar in lock position if does rattle and bounce open (recycled magnets from a HDD).
HDD magnets are superb made couple hood hooks for scope and meter equipment from them and a door latch and work amazingly well vs off the shelf junk .
HDD magnets are superb made couple hood hooks for scope and meter equipment from them and a door latch and work amazingly well vs off the shelf junk .