Hamas agrees to hold general elections in Gaza