Try to fix some memory issues

Using the 'with' statement to properly close the file once parsed.
Apply the style to the correct element