This is recommended not to sleep alone but it is not forbidden. As for putting the mattress up, this has no evidence in the Sunnah to back it up to my knowledge.

The prophet salallahu alahi wa sallam forbade any man to sleep alone{Ahmad al Musnad 2/91} Is this case apply for woomen too? I hear some pleople said that if u have an empty room where is a bed inside u must put up the mattress becose if not the djins will sleep there