Activating Brange button closes program
An error is created when the plot's y-axis is re-aligned by using the Brange function, closing the program. This issue does not happen on the original version of the code, before the improved threading functions were introduced.