Not to mention that even a vote to exit will take years and there will be provisions to maintain current status it's highly unlikely that the UK will kick out millions of residents not to mention have to take in millions of UK nationals that are living in other EEA countries (which on it's own could cost the UK economy much more in the short term, as when people are forcibly kicked out of their country are quite often not in the best financial position to make that move).
While it's true that the UK takes in a large amount of EU nationals they export almost as many there is a slight difference that the ones that leave the UK often posses high paying jobs in the first place while many individuals that come in come in often as a qualified job seeker meaning that they might receive more benefits at least initially than paying out as far as taxes go.
This situation is also quite common among immigrants from lower income EU countries like Poland and Romania which also historically exported allot of their income back home, it wasn't that uncommon for them to immigrate to the UK for 3-5 years just to make enough money to buy a house in their home country and then return there which is some what of an issue on it's own also.
There probably should be a better process to ensure that there isn't considerable wealth drain on the stronger economies due to economic immigration but more importantly that there isn't a brain and skill drain on the poorer EU members, pretty much any one I've spoken too from Bulgaria and Romania curses the EU more than your average UKIP voter mostly because it seems that joining the EU caused a massive exodus of anyone who could leave for greener fields which often are the most educated and better off people in the first place, those who can actually drive the country forward.