Just for completeness, make sure that the /etc/passwd file gets closed after reading system users.