Fixes related to trial length and trial count

1. The script now saves the .mat file after every trial. So even if the
script crashes in the middle due to various reasons, e.g., fewer than
expected trial mat files, the results will be saved.

2. Revised the code so that the sound playing functions can play trial
recordings of any duration, instead of only a fixed duration as specified
in the input argument "recordTime".

This is useful because of some recent data reprocessing, which caused the
trial sound files to vary in duration in some subjects (e.g., P03)