Fix unchecked return value. CID#1090413

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
Make unreachable code, reachable. CID#1090412

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
Close file pointer to avoid resource leak. CID#1090411

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>