Stop looping endlessly if file cannot be read in built-in functions

Specifically, regline, getfields and countlinesmatching were affected.
(Redmine #2453)
Do not write allclasses.txt for every bundle iteration