Fixed: tasks/sync has too many parallel ldap connections & tasks/phoneRoomMapping never exits

The script tasks/phoneRoomMapping never exited for me. Probably one of the libraries used in it blocks cleanup functions. I added a simple counter to check if we are completely done and then exit. 

The script tasks/sync did not seem to work properly because there were too many parallel connections on the LDAP connection.