When the mildly Islamist Justice and Development ( AK ) party tweaked the constitution in order to ease the headscarf ban soon after being re-elected in 2007 , it was threatened with closure by a prosecutor and only narrowly survived .