Fixed unclosed while loop.