How does the Magnitude of an FFT relate back to the Time Series wave it was created from?
You can calculate the coherent or DC gain of a window with:

coherent_gain = sum(window)/n;

with a Hann window, and n = 40, this comes to 0.4875, as hotpaw2 mentioned.

You can therefore eliminate the effect of the coherent gain of the window on your spectral estimate by replacing windowed_time_signal = time_signal.*window; with windowed_time_signal = time_signal.*window/coherent_gain;.

If your main priority is very accurate amplitude - and you're unconcerned with spectral leakage as Sebastian mentioned, then the flattop window
is the way to go. Here's the matlab docs.

Just replace window = hann(n)'; with window = flattopwin(n)';.

Also, if you have the ability to collect more samples, that will likely improve the spectral estimate from your FFT (assuming the underlying process in your application is somewhat stationary/ergodic). You can also take FFTs of successive (possibly overlapping) slices and average them.

Furthermore, as hotpaw2 mentioned, selecting a sample rate depends very strongly on your application, and how many samples you intend to collect. That said, I've often used fs = 2.56 * bw, with good results when it comes to spectral analysis or digital filtering.