Metastability of forest ecosystems infested by bark beetles