Local sufficient condition for magnetohydrodynamic stability of closed line systems