Fix some cppcheck reports (part3)

- (error) Resource leak: f
- (style) Statements following return, break, continue, goto or throw will never be executed (1 of them)
- (style) Unused variable (most of them)