Use open() function instead of file()

Signed-off-by: Michal Čihař <michal@cihar.com>
Remove debugging code

Signed-off-by: Michal Čihař <michal@cihar.com>