A bill calling for a referendum on the UK's membership of the EU in 2017 has been approved by the House of Commons.