What were the main causes of the war of 1812 and what were its most important economic consequences?