Fixes error in the rewrite tag output and closes the contents of the media attribute.