Added function for printing spikes to file