renamed include guards, removed unnecsssary close() calls