An exact formula for the statistics of the current in the TASEP with open boundaries